text
stringlengths
6
9.38M
SELECT SUM(quantity) AS total_items_sold FROM Orderitems WHERE prod_id = 'BR01';
/* Navicat MySQL Data Transfer Source Server : localhost_3306 Source Server Version : 50711 Source Host : localhost:3306 Source Database : cquptlibrary Target Server Type : MYSQL Target Server Version : 50711 File Encoding : 65001 Date: 2016-08-14 12:49:09 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for book -- ---------------------------- DROP TABLE IF EXISTS `book`; CREATE TABLE `book` ( `id` int(10) NOT NULL, `type` varchar(20) DEFAULT NULL, `name` varchar(20) NOT NULL COMMENT '书名', `author` varchar(20) NOT NULL, `site` varchar(30) DEFAULT NULL, `number` varchar(10) NOT NULL COMMENT '编号', `borrow_num` tinyint(7) NOT NULL DEFAULT '0', `status` int(2) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), KEY `bookname` (`name`) USING BTREE, KEY `bookauthor` (`author`) USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `stuid` smallint(10) unsigned NOT NULL, `name` varchar(20) NOT NULL, `borrow_now` tinyint(2) DEFAULT NULL, `borrow_all` smallint(5) DEFAULT NULL, `arrearage` smallint(5) NOT NULL DEFAULT '0', PRIMARY KEY (`stuid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- ---------------------------- -- Table structure for user_book -- ---------------------------- DROP TABLE IF EXISTS `user_book`; CREATE TABLE `user_book` ( `id` int(10) NOT NULL AUTO_INCREMENT, `stuid` int(10) DEFAULT NULL, `bookid` int(10) DEFAULT NULL, `date` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP, `status` tinyint(2) NOT NULL DEFAULT '1' COMMENT '1为未归还,0为归还', PRIMARY KEY (`id`), KEY `borrower` (`stuid`), KEY `book` (`bookid`), KEY `time` (`date`) USING BTREE ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 -- Generation Time: Apr 03, 2018 at 09:08 PM -- Server version: 5.7.19 -- PHP Version: 5.6.31 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: `amplirt` -- -- -------------------------------------------------------- -- -- Table structure for table `destinataire` -- DROP TABLE IF EXISTS `destinataire`; CREATE TABLE IF NOT EXISTS `destinataire` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nom` varchar(30) NOT NULL, `prenom` varchar(30) NOT NULL, `tel` varchar(10) NOT NULL, `mail` varchar(20) DEFAULT NULL, `type` varchar(15) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=208 DEFAULT CHARSET=latin1; -- -- Dumping data for table `destinataire` -- INSERT INTO `destinataire` (`id`, `nom`, `prenom`, `tel`, `mail`, `type`) VALUES (5, 'Jean', 'Marc', '0123456789', NULL, 'Personnel'), (7, 'Nadwah', 'Azizah', '097456341', 'nadwah@gmail.com', 'Professionnel'), (34, 'Marc', 'Antoine', '0172644312', 'mantoine@unice.fr', 'Personnel'), (32, 'Obrien', 'Dylan', '079995509', 'dylan@gmail.com', 'Professionnel'), (31, 'Pierre', 'Maire', '0765656512', 'jean@gmail.com', 'Personnel'), (45, 'Afa', '', '0771764091', 'afa@gmail.com', 'Professionnel'), (39, 'Aqilah', 'Shah', '0876768612', 'aqilah@yahoo.com', 'Professionnel'), (50, 'Haris', 'Zaty', '0771762389', 'zaty@yahoo.com', 'Professionnel'), (73, 'Antoine', 'Lucas', '065746382', 'lucas@gmail.com', 'Personnel'), (51, 'McCall', 'Scott', '0122642771', 'scott@teenwolf.com', 'Professionnel'), (64, 'Stilinski', 'Stiles', '0972536273', 'stiles@teenwolf.com', 'Professionnel'), (63, 'Martin', 'Lydia', '0987674587', 'lydia@teenwolf.com', 'Professionnel'), (65, 'Argent', 'Alisson', '011112334', 'alisson@teenwolf.com', 'Professionnel'), (66, 'Hale', 'Derek', '084324832', 'derek@teenwolf.com', 'Professionnel'), (74, 'Durand', 'Julie', '0127842382', 'julie@gmail.com', 'Personnel'), (207, 'Tenret', 'Thomas', '0668762651', 'thomas@gmail.com', 'Personnel'), (75, 'Dubois', 'Alice', '056673212', 'alice@yahoo.com', 'Personnel'), (203, 'Dupand', 'Marie', '', '', 'Personnel'), (204, 'Sheldon Lee', 'Cooper', '0771765719', 'shelly@yahoo.com', 'Personnel'), (206, 'Patric', 'Laura', '0975289371', 'laura@yahoo.com', 'Personnel'); -- -------------------------------------------------------- -- -- Table structure for table `groupe` -- DROP TABLE IF EXISTS `groupe`; CREATE TABLE IF NOT EXISTS `groupe` ( `idGroupe` int(11) NOT NULL AUTO_INCREMENT, `nomGroupe` varchar(20) DEFAULT NULL, `idDest` int(11) DEFAULT NULL, PRIMARY KEY (`idGroupe`), KEY `idDest` (`idDest`) ) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1; -- -- Dumping data for table `groupe` -- INSERT INTO `groupe` (`idGroupe`, `nomGroupe`, `idDest`) VALUES (77, 'Family', 73), (3, 'TP Java', 39), (4, 'TP Reseaux', 7), (60, 'TP Java', 5), (48, 'TP WAN', 7), (11, 'TP Telecom', 32), (12, 'TP Java', 45), (49, 'TP WAN', 32), (16, 'TP WAN', 50), (19, 'TP Info', 51), (82, 'Amis', 7), (81, 'Amis', 50), (80, 'Amis', 39), (76, 'Family', 75), (58, 'Family', 203), (32, 'Teen Wolf', 51), (33, 'Teen Wolf', 64), (34, 'Teen Wolf', 63), (35, 'Teen Wolf', 65), (57, 'TP Elec', 203), (37, 'Teen Wolf', 66), (56, 'Family', 204), (79, 'Amis', NULL), (98, 'Amis', 45); -- -------------------------------------------------------- -- -- Table structure for table `message` -- DROP TABLE IF EXISTS `message`; CREATE TABLE IF NOT EXISTS `message` ( `idmsg` int(11) NOT NULL AUTO_INCREMENT, `dest` varchar(30) NOT NULL, `msg` text NOT NULL, PRIMARY KEY (`idmsg`) ) ENGINE=MyISAM AUTO_INCREMENT=95 DEFAULT CHARSET=latin1; -- -- Dumping data for table `message` -- INSERT INTO `message` (`idmsg`, `dest`, `msg`) VALUES (1, 'toto', 'salut toto!'), (2, 'titi', 'ca va titi?'), (4, 'Nadwah', 'Salut Nadwah!'), (8, 'Jean', 'test msg'), (6, 'Izzati', 'Aujourdhui c\'est vendredi. Tu es libre?'), (7, 'toto', 'tu es libre demain?'), (9, 'Jean', 'test 123'), (10, 'Argent', 'Please don\'t die!'), (11, 'McCall', 'I need season 8!!!!!'), (17, 'Jean', 'je fait un test'), (18, 'Nasrul', 'Test de msg crypte'), (27, 'Stilinski', 'Test msg groupe'), (26, 'McCall', 'Test msg groupe'), (28, 'Martin', 'Test msg groupe'), (29, 'Argent', 'Test msg groupe'), (30, 'Hale', 'Test msg groupe'), (38, 'Bob', 'Hai bob'), (39, 'Aziz', 'Elec test'), (40, 'Bob', 'Elec test'), (41, 'Obrien', 'test tel'), (42, 'Haris', 'test tel'), (43, 'Toto', 'tesrjhfjtdgfcv'), (44, 'Aziz', 'vtyfiub hkv'), (45, 'Bob', 'vtyfiub hkv'), (46, 'Sarah Aziz', 'On a cours demain!'), (47, 'Marley Bob', 'On a cours demain!'), (94, 'Cooper Sheldon Lee', 'test'), (93, 'Marie Dupand', 'test'), (53, 'Scott McCall', 'reunion ce soir!'), (54, 'Stiles Stilinski', 'reunion ce soir!'), (55, 'Lydia Martin', 'reunion ce soir!'), (56, 'Alisson Argent', 'reunion ce soir!'), (57, 'Derek Hale', 'reunion ce soir!'), (58, 'Scott McCall', 'Test'), (59, 'Zaty Haris', 'Test'), (60, 'Scott McCall', 'testcrypte'), (61, 'Zaty Haris', 'testcrypte'), (62, 'Zaty Haris', 'le cours annule demain'), (63, 'Iman Nasrul', 'le cours annule demain'), (64, 'Marc', 'salut marc'), (65, 'Argent', 'salut'), (92, 'Alice Dubois', 'test'), (91, 'Lucas Antoine', 'test'), (90, 'Nadwah', 'salut'), (89, 'Marie Dupand', 'Cours annule aujourdhui'), (88, 'Marley Bob', 'Cours annule aujourdhui'), (87, 'Sarah Aziz', 'Cours annule aujourdhui'), (86, 'Nasrul', 'Salut! ca va?'), (85, 'Marc', 'test'), (84, 'Sheldon Lee', 'Dernier episode aujourdhui!'); 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 */;
UPDATE Vendors AS V SET V.vend_state = UPPER(V.vend_state) WHERE V.vend_country = 'USA'; UPDATE Customers AS C SET V.cust_state = UPPER(C.cust_state) WHERE C.cust_country = 'USA';
UPDATE invoices SET credit_total = invoice_total * .1, payment_total = invoice_total - credit_total WHERE invoice_id = 115; /* Write an UPDATE statement that modifies the invoice you added in exercise 4. This statement should change the credit_total column so it’s 10% of the invoice_total column, and it should change the payment_total column so the sum of the payment_total and credit_total columns are equal to the invoice_total column. */
-- Database: controle_compras -- DROP DATABASE controle_compras; -- \l - lista os dbs \c controle_empresas -- \c conecta com um db CREATE DATABASE controle_compras WITH OWNER = postgres ENCODING = 'UTF8' LC_COLLATE = 'Portuguese_Brazil.1252' LC_CTYPE = 'Portuguese_Brazil.1252' TABLESPACE = pg_default CONNECTION LIMIT = -1; CREATE TABLE compras( id serial primary key, valor decimal, data date, observacao varchar(255), recebido smallint ); -- \d descreve a tabela -- \i importa o dump -- ele faz diversos selects, os que possuem diferenças são: SELECT * FROM compras where valor > 1000 and data != '06-22-2010'; -- no meu ps essa data não funciona, porém o '!=' funciona perfeitamente. INSERT INTO compras (valor, data, observacao, recebido) VALUES (2000, '2011-09-04', 'carnaval em cancun', 1); ALTER TABLE compras ALTER COLUMN valor set not null; -- pequena diferença em relação ao mySQL CREATE TYPE enum_pagamento as enum('cartão','dinheiro', 'boleto'); ALTER TABLE compras ADD COLUMN form_pagto enum_pagamento; ALTER TABLE compras RENAME form_pagto TO forma_pagamento; -- não é possível definir uma coluna como not null sem antes eliminar todos valores nulos dentro dela. ALTER TABLE compras ALTER COLUMN recebido SET DEFAULT 0; -- Esse comando só estabelece os futuros valores nulos como 0 -- Os antigos valores nulos permanecem iguais. SELECT to_char(data, 'YYYY') as ano, sum(valor) as total from compras GROUP BY ano; -- ao utilizarmos o COUNT() o '*' conta todas as linhas e ao passar uma coluna conta apenas os valores não nulos; select ( select sum(c1.valor) from compras c1 where c1.data between '2014-01-01' and '2014-12-31' ) - ( select sum(c2.valor) from compras c2 where c2.data between '2015-01-01' and '2015-12-31' ); select sum(c1.valor) - ( select sum(c2.valor) from compras c2 where c2.data between '2015-01-01' and '2015-12-31' ) from compras c1 where c1.data between '2014-01-01' and '2014-12-31'; -- duas formas de fazer diferenças entre queries; -- OPERADORES < -- para menor > -- para maior <= -- para menor ou igual >= -- para maior ou igual = -- para igual <> ou != -- para diferente SELECT max(valor) from compras; SELECT min(data) from compras; -- pegam valor maximo e minimo; -- Ao inserir pode-se adicionar outra inserção colocando novos valores separados por virgula, exemplo: insert into compras (...) VALUES (...) -- primeira inserção , (...) -- segunda inserção select * from Compras c join Lojas l on c.loja_id = l.id and l.nome = 'Carfour'; -- não é necessário colocar um WHERE, apenas uma outra condição no on tem o mesmo efeito; SELECT * FROM compras c1 JOIN compras c2 ON c1.valor = c2.valor;
CREATE DATABASE udemy; USE udemy; CREATE TABLE users ( userId INTEGER (9) NOT NULL AUTO_INCREMENT, username CHAR(50), userPic VARCHAR (50), courseCount INTEGER (5), reviewCount INTEGER (5), createdAt DATE, updatedAt DATE, PRIMARY KEY (userId) ); CREATE TABLE courses ( courseId INTEGER (8) NOT NULL AUTO_INCREMENT, name VARCHAR (100), createdAt DATE, updatedAt DATE, PRIMARY KEY (courseId) ); CREATE TABLE reviews ( reviewId INTEGER (10) NOT NULL AUTO_INCREMENT, userId INTEGER (9), courseId INTEGER (8), rating INTEGER (2), review VARCHAR (600), date TIMESTAMP, upvotes INTEGER (5), downvotes INTEGER (5), reported INTEGER (1), createdAt DATE, updatedAt DATE, PRIMARY KEY (reviewId), FOREIGN KEY (userId) REFERENCES users (userId), FOREIGN KEY (courseId) REFERENCES courses (courseId) );
INSERT IGNORE INTO `#__mxcalendar_config`(id,param,value) VALUES(34,'mxcEventListLabelLocation','');
drop table SCRAPPING_SITE; drop table attention_search; drop table attention_item; drop table do_scheduler; CREATE TABLE SCRAPPING_SITE( target_name TEXT, target_url TEXT, detail_target_url TEXT, category_big TEXT, category_middle TEXT, category_small TEXT, search_word TEXT, create_date TEXT, recruit_title TEXT, company_name TEXT, detail_uri TEXT, task TEXT, employment_type TEXT, company_info TEXT, need_career TEXT, salary TEXT, apply_start_date, apply_end_date TEXT, work_place TEXT, main_service TEXT, work_info TEXT, career_requirements TEXT, preference TEXT, company_culture TEXT, team_env TEXT, need_doc TEXT, contact_people TEXT, hashtag TEXT, id INTEGER, PRIMARY KEY(id) ); create table attention_search ( search_word TEXT, username TEXT, id INTEGER, PRIMARY KEY(id) ); create table attention_item ( id_scrapping_sie INTEGER, username TEXT, id INTEGER, PRIMARY KEY(id) ); create table do_scheduler( target_site_name TEXT, start_date TEXT, end_date TEXT, during_time TEXT, id INTEGER, PRIMARY KEY(id) );
--修改人 田进 --修改时间 2012-11-29 --修改内容 增加ERP发送时间 ALTER TABLE bis_exc ADD(erp_send_date varchar(300)); comment on column BIS_EXC.ERP_SEND_DATE is 'erp发送时间'; --增加用户表外系统主键 ALTER TABLE bt_user ADD(external_sys_pk varchar(100)); comment on column BT_USER.EXTERNAL_SYS_PK is '外部系统主键(中烟二期用)'; --增加账户表外系统主键 ALTER TABLE bt_bank_acc ADD(external_sys_pk varchar(100)); comment on column bt_bank_acc.EXTERNAL_SYS_PK is '外部系统主键(中烟二期用)'; --增加历史明细外系统主键 ALTER TABLE bis_acc_his_dtl ADD(external_sys_pk varchar(100)); comment on column bis_acc_his_dtl.EXTERNAL_SYS_PK is '外部系统主键(中烟二期用)'; --增加历史明细批次号字段 ALTER TABLE bis_acc_his_dtl add(batchId varchar(100)); comment on column bis_acc_his_dtl.batchId is '批次号(中烟二期用)'; --增加当日明细外系统主键 ALTER TABLE bis_acc_dtl ADD(external_sys_pk varchar(100)); comment on column bis_acc_dtl.EXTERNAL_SYS_PK is '外部系统主键(中烟二期用)'; --增加预算科目外系统主键 ALTER TABLE fbs_item ADD(external_sys_pk varchar(100)); comment on column fbs_item.EXTERNAL_SYS_PK is '外部系统主键(中烟二期用)'; --增加预算关系表 create table fbs_relation ( external_sys_pk varchar(100) primary key, cw_id varchar(100), bt_id varchar(100) ); comment on column FBS_RELATION.EXTERNAL_SYS_PK is '系统内码(外系统主键)'; comment on column FBS_RELATION.CW_ID is 'NC业务预算指标'; comment on column FBS_RELATION.BT_ID is '资金管理预算指标'; --初始化扩展字段属性表的单位表bt_user扩展字段:reverse11 insert into BT_Ext_Field_Property (Id,ext_Table_Code,ext_Field_Code,component_Label,default_Value,ext_Type,ext_Values,is_Required,is_Readonly,view_Sort,is_Enabled) values ((select gen_value+1 from tb_generator where gen_name='BT_EXT_FIELD_PROPERTY_ID'), 'BT_USER', 'external_sys_pk', '外系统主键', null, '1', null, 1, 0, '01', 1); --同步更新种子表的主键值 update tb_generator set gen_value= gen_value+1 where gen_name='BT_EXT_FIELD_PROPERTY_ID'; commit; --是否使用拜特银企接口 在bt_bank_acc 表 字段名 为 is_bankerp(0为走银企,1为走监管系统) DECLARE VN_COUNT NUMBER; BEGIN SELECT COUNT(*) INTO VN_COUNT FROM user_tab_columns where table_name='BT_BANK_ACC' AND COLUMN_NAME='IS_BANKERP'; IF VN_COUNT < 1 THEN execute immediate 'alter table bt_bank_acc add is_bankerp varchar2(1) default 1'; COMMIT; END IF; END; / --创建资金调拨需要发送到监管系统的数据视图 create or replace view v_fjzh_bis_exc as select bis.voucher_no,--票据号码(内部转账ID) bis.user_name,--申请人 bis.req_date,--内部转账请求时间(申请时间) bis.amt,--付款金额(转账金额) bis.corp_id,--付方单位编号 bis.payer_bank_name,--付款方开户行(转出行) bis.payer_acc_no,--付款方账号(转出账户的账号) bis.payer_acc_name,--付款方户名(转出账户名称) opp_bt.corp_code,--收方单位编码(收款单位编码) bis.payee_bank,--收方开户行(转入行) bis.payee_acc_no,--收方账号(转入账户的账号) bis.payee_name,--收方户名(转入账户名称) bis.abs,--摘要(用途) bis.postscript --附言(备注) from bis_exc bis inner join bt_bank_acc bt on bis.payer_acc_no= bt.bank_acc left join bt_bank_acc opp_bt on bis.payee_acc_no=opp_bt.bank_acc where bis.voucher_stat='3' and bt.is_bankerp='1'; --创创反馈银行交易明细(请求)需要发送到监管系统的数据视图 create or replace view v_erp_bis_query_cmd_bankacc as select bis.serial_id, bis.bank_acc, bis.bif_code, bis.start_time, bis.end_time from bis_query_cmd bis,bt_bank_acc bt where bis.trans_id in('900020','900030') and bis.bank_acc=bt.bank_acc and bt.is_bankerp='1' and bis.finish_sign='3'; --创建账额查询需要发送到监管系统的数据视图 create or replace view v_erp_bis_query_cmd_bal as select bis.serial_id, bis.trans_id, bis.bank_acc, bis.bif_code, bis.start_time, bis.end_time from bis_query_cmd bis,bt_bank_acc bt where bis.trans_id in('900010','900040') and bis.bank_acc=bt.bank_acc and bt.is_bankerp='1' and bis.finish_sign='3';
use hab; select * from user; select * from feedback; select * from location; select * from type; -- Feedback tipo De Para select a.name as Es, b.name as De, c.name as Para, title as Titulo, text as Feedback, d.name as Categoria from feedback inner join type a on a.id = type_id inner join user b on b.id = from_user_id inner join user c on c.id = to_user_id inner join category d on d.id = category_id; -- Usuarios y sus localidades select user.name as Nombre, user.surname as Apellidos, location.name as Localidad from user inner join location on location.id = location_id;
create procedure sp_acc_checkdocumentadjusted(@ContraID Int) as Select 'AdjustedFlag' = IsNull(AdjustedFlag,0) from ContraDetail where ContraID = @ContraID
INSERT INTO `super_rent`.`user` VALUES ('admin', 'admin', 'STAFF');
-- db.sql -- 회원 테이블 select * from tblUser; -- 게시판 테이블 > 단계 + 확장 -- 기본 게시판 drop table tblBoard; drop sequence seqBoard; create table tblBoard ( seq number primary key, --글번호(PK) id varchar2(30) not null references tblUser(id), --아이디(FK) subject varchar2(500) not null, --제목 content varchar2(4000) not null, --내용 regdate date default sysdate not null, --작성시각 readcount number default 0 not null, --조회수 tag varchar2(1) not null check(tag in ('y','n')) --글내용에 HTML 태그 허용 유무 ); create sequence seqBoard; select * from tblBoard; select seq, (select name from tblUser where id = tblBoard.id) as name, subject, readcount, regdate from tblBoard order by seq desc; create or replace view vwBoard as select seq, id, (select name from tblUser where id = tblBoard.id) as name, subject, readcount, regdate, (sysdate - regdate) as isnew from tblBoard b;
-- Adminer 4.2.2 MySQL dump SET NAMES utf8; SET time_zone = '+00:00'; SET foreign_key_checks = 0; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; DROP TABLE IF EXISTS `donatedata`; CREATE TABLE `donatedata` ( `id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `sex` varchar(10) NOT NULL, `dayOfDonate` varchar(50) NOT NULL, `donateDetail` text NOT NULL, `donateMoney` float NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `donatedata` (`id`, `name`, `sex`, `dayOfDonate`, `donateDetail`, `donateMoney`) VALUES (7, 'เกียรติศักดิ์ หล่อวงสา', 'ชาย', 'พรุ่งนี้', 'เสียใจมากครับพี่ปอ .-_-.', 20), (8, '0', '1', '2', '3', 4), (5, 'กานต์', 'ชาย', 'วันนี้แหละ', 'ขอแสดงความเสียใจกับพี่ปอด้วยครับ', 1); -- 2016-01-29 10:13:40
-- noinspection SqlNoDataSourceInspectionForFile SELECT a.pid, a.abn, a.ent_typ_cd, a.org_nm, a.prev_org_nm, try(date_format(a.org_nm_change_date,'%d%m%Y')) as org_nm_change_date, a.nm_titl_cd, a.prsn_gvn_nm, a.prsn_othr_gvn_nm, a.prsn_fmly_nm, a.nm_sufx_cd, a.prev_nm_titl_cd, a.prev_prsn_gvn_nm, a.prev_prsn_othr_gvn_nm, a.prev_prsn_fmly_nm, a.prev_nm_sufx_cd, try(date_format(a.nm_change_date,'%d%m%Y')) as nm_change_date, try(date_format(date_parse(a.abn_regn_dt, '%Y%m%d'),'%d%m%Y')) as abn_regn_dt, try(date_format(date_parse(a.abn_cancn_dt, '%Y%m%d'),'%d%m%Y')) as abn_cancn_dt, if(a.abn_cancn_dt = '','Active','Cancelled') as ABN_Status__c, a.mn_trdg_nm, a.prev_mn_trdg_nm, try(date_format(a.mn_trdg_change_date,'%d%m%Y')) as mn_trdg_change_date, a.son_addr_ln_1, a.son_addr_ln_2, a.son_sbrb, a.son_stt, a.son_pc, a.son_cntry_cd, a.son_dpid, a.prev_son_addr_ln_1, a.prev_son_addr_ln_2, a.prev_son_sbrb, a.prev_son_stt, a.prev_son_pc, a.prev_son_cntry_cd, a.prev_son_dpid, try(date_format(a.son_change_date,'%d%m%Y')) as son_change_date, a.mn_bus_addr_ln_1, a.mn_bus_addr_ln_2, a.mn_bus_sbrb, a.mn_bus_stt, a.mn_bus_pc, a.mn_bus_cntry_cd, a.mn_bus_dpid, a.prev_mn_bus_addr_ln_1, a.prev_mn_bus_addr_ln_2, a.prev_mn_bus_sbrb, a.prev_mn_bus_stt, a.prev_mn_bus_pc, a.prev_mn_bus_cntry_cd, a.prev_mn_bus_dpid, try(date_format(a.mn_bus_change_date,'%d%m%Y')) as mn_bus_change_date, a.ent_eml, a.prev_ent_eml, try(date_format(a.ent_eml_change_date,'%d%m%Y')) as ent_eml_change_date, a.prty_id_blnk, try(date_format(date_parse(a.gst_regn_dt, '%Y%m%d'),'%d%m%Y')) as gst_regn_dt, try(date_format(date_parse(a.gst_cancn_dt, '%Y%m%d'),'%d%m%Y')) as gst_cancn_dt, a.mn_indy_clsn, a.mn_indy_clsn_descn, a.prev_mn_indy_clsn, a.prev_mn_indy_clsn_descn, try(date_format(a.mn_indy_change_date,'%d%m%Y')) as mn_indy_change_date, try_cast(a.acn as integer) as acn, a.sprsn_ind, bl.locn_typ_cd, try(date_format(date_parse(bl.locn_strt_dt, '%Y%m%d'),'%d%m%Y')) as locn_strt_dt, bl.bus_locn_addr_ln_1, bl.bus_locn_addr_ln_2, bl.bus_locn_sbrb, bl.bus_locn_stt, bl.bus_locn_pc, bl.bus_locn_cntry_cd, bl.bus_locn_dpid, bl.bus_locn_ltd, bl.bus_locn_lngtd, bl.bus_locn_msh_blk, bl.bus_locn_gnaf_pid, bl.bus_locn_posnl_rlblty, bl.bus_locn_ph_area_cd, bl.bus_locn_ph_num, bl.bus_locn_ph_area_cd_mbl, bl.bus_locn_ph_num_mbl, concat(coalesce (bl.bus_locn_ph_area_cd,''),coalesce (bl.bus_locn_ph_num,'')) as Phone, concat(coalesce (bl.bus_locn_ph_area_cd_mbl,''),coalesce (bl.bus_locn_ph_num_mbl,'')) as Emergency_mobile_phone, bl.bus_locn_eml, bl.bus_locn_indy_clsn, bl.bus_locn_indy_clsn_descn, -- bl.lga_code_2016, -- bl.state_code_2016, -- bl.state_name_2016, -- bl.area_albers_sqkm, -- bl.local_government_area, -- bl.vgbo_region, -- bl.like_councils, bn.bus_nm FROM agency_combined a JOIN location bl ON a.pid = bl.pid JOIN (SELECT array_join(array_agg(bus_nm), ', ') bus_nm,pid from businessname group by pid) bn ON a.pid = bn.pid WHERE a.ent_typ_cd in ('IND', 'LPT', 'OIE', 'PRV', 'PTR', 'PTT', 'PUB', 'STR', 'UIE') AND bl.locn_typ_cd = '010' AND bl.bus_locn_indy_clsn = '6931' limit 1;
INSERT INTO fxPageOrders (Name) VALUES ('Straight'); INSERT INTO fxPageOrders (Name) VALUES ('Random');
/** * Arquivo ddl que desfaz alterações do ddl up */ /* * * TIME Tributário * * */ alter table rharqbanco drop column if exists rh34_parametrotransmissaoheader; alter table rharqbanco drop column if exists rh34_parametrotransmissaolote ; alter table rharqbanco drop column if exists rh34_codigocompromisso ; ALTER TABLE parissqn DROP COLUMN q60_templatebaixaalvaranormal; ALTER TABLE parissqn DROP COLUMN q60_templatebaixaalvaraoficial; alter table numpref drop column k03_toleranciacredito; DROP TABLE IF EXISTS tabdesccadban CASCADE; DROP SEQUENCE IF EXISTS tabdesccadban_k114_sequencial_seq; delete from histcalc where k01_codigo = 507; /* * * FIM TIME Tributário * * */ /** * TIME B */ -- mensageriaacordodb_usuario drop sequence IF EXISTS mensageriaacordodb_usuario_ac52_sequencial_seq; drop table IF EXISTS mensageriaacordodb_usuario; drop INDEX IF EXISTS mensageriaacordodb_usuario_db_usuarios_in -- mensageriaacordo DROP SEQUENCE mensageriaacordo_ac51_sequencial_seq; DROP TABLE mensageriaacordo; -- mensageriaacordoprocessados DROP SEQUENCE mensageriaacordoprocessados_ac53_sequencial_seq; DROP TABLE mensageriaacordoprocessados; DROP TABLE IF EXISTS placaixaprocesso CASCADE; DROP TABLE IF EXISTS slipprocesso CASCADE; DROP TABLE IF EXISTS pagordemprocesso CASCADE; DROP SEQUENCE IF EXISTS placaixaprocesso_k144_sequencial_seq; DROP SEQUENCE IF EXISTS slipprocesso_k145_sequencial_seq; DROP SEQUENCE IF EXISTS pagordemprocesso_e03_sequencial_seq; DROP INDEX IF EXISTS placaixaprocesso_placaixa_in; DROP INDEX IF EXISTS slipprocesso_slip_in; DROP INDEX IF EXISTS pagordemprocesso_pagordem_in; DROP TABLE IF EXISTS empnotaprocesso CASCADE; DROP SEQUENCE IF EXISTS empnotaprocesso_e04_sequencial_seq; DROP INDEX IF EXISTS empnotaprocesso_empnota_in; /** * FIM TIME B */ /* * * TIME C * * */ alter table escoladiretor ALTER COLUMN ed254_i_atolegal set not null; alter table edu_relatmodel drop column if exists ed217_brasao; /** * T91754 */ DROP SEQUENCE IF EXISTS rechumanomovimentacao_ed118_sequencial_seq; DROP INDEX IF EXISTS rechumanomovimentacao_usuario_in; DROP INDEX IF EXISTS rechumanomovimentacao_rechumano_in; DROP INDEX IF EXISTS rechumanomovimentacao_escola_in; ALTER TABLE rechumanohoradisp ADD ed33_i_rechumano int4 NOT NULL default 0; update rechumanohoradisp set ed33_i_rechumano = old from w_rechumanohoradisp where rechumanohoradisp.ed33_i_codigo = w_rechumanohoradisp.ed33_i_codigo; DROP TABLE IF EXISTS w_rechumanohoradisp; ALTER TABLE rechumanohoradisp DROP COLUMN IF EXISTS ed33_rechumanoescola; ALTER TABLE rechumanohoradisp DROP COLUMN IF EXISTS ed33_ativo; DROP TABLE IF EXISTS rechumanomovimentacao; /** * T93234 */ -- lab_requiitem alter table lab_requiitem drop column la21_observacao; /* * * FIM TIME C * * */ /* * * INICIO TIME D * T 93849 * */ ALTER TABLE issqn.ativid DROP COLUMN q03_tributacao_municipio; /* * * FIM TIME D * * */
-- phpMyAdmin SQL Dump -- version 4.0.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Sep 15, 2014 at 06:00 PM -- Server version: 5.6.12-log -- PHP Version: 5.4.16 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: `login` -- CREATE DATABASE IF NOT EXISTS `login` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `login`; -- -------------------------------------------------------- -- -- Table structure for table `age` -- CREATE TABLE IF NOT EXISTS `age` ( `species_id` int(10) NOT NULL, `age` varchar(50) CHARACTER SET latin1 NOT NULL, KEY `species_id` (`species_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `age` -- INSERT INTO `age` (`species_id`, `age`) VALUES (1, '8 tjedana do 6 mjeseci'), (1, '6 do 12 mjeseci'), (1, 'odrasli pas'), (1, 'do 8 tjedana'), (2, 'do 10 tjedana'), (2, '10 tjedana do 6 mjeseci'), (2, '6 do 12 mjeseci'), (2, 'odrasle macka'), (3, 'do 6 mjeseci'), (3, 'odrasli glodavac'); -- -------------------------------------------------------- -- -- Table structure for table `pets_all` -- CREATE TABLE IF NOT EXISTS `pets_all` ( `pet_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'auto incrementing pet_id of each pet, unique index', `pet_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'pet''s name', `pet_gender` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `pet_species` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `pet_age` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `pet_weight` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `pet_note` text CHARACTER SET utf8 COLLATE utf8_unicode_ci, `pet_owner` int(11) NOT NULL, PRIMARY KEY (`pet_id`), KEY `pet_owner` (`pet_owner`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='user data' AUTO_INCREMENT=60 ; -- -- Dumping data for table `pets_all` -- INSERT INTO `pets_all` (`pet_id`, `pet_name`, `pet_gender`, `pet_species`, `pet_age`, `pet_weight`, `pet_note`, `pet_owner`) VALUES (42, 'Žuja', 'F', '2', '10 tjedana do 6 mjeseci', 'perzijska', '44444444', 35), (27, 'Gricko', 'M', '1', 'odrasli pas', '11-22 kg', 'Monika ga ne zna svezat!', 35), (41, 'zlajo', 'M', '1', '6 do 12 mjeseci', '11-22 kg', 'Hihihihi', 35), (57, 'Gricko', 'M', '2', 'do 10 tjedana', 'perzijska', 'hahaha', 33), (58, 'lola', 'M', '2', '10 tjedana do 6 mjeseci', 'domaca', 'jsjsj', 33), (59, 'Nives Celzijus', 'M', '1', '8 tjedana do 6 mjeseci', '11-22 kg', 'ssss', 33); -- -------------------------------------------------------- -- -- Table structure for table `species` -- CREATE TABLE IF NOT EXISTS `species` ( `species_id` int(10) NOT NULL AUTO_INCREMENT, `species` varchar(10) CHARACTER SET latin1 NOT NULL, PRIMARY KEY (`species_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; -- -- Dumping data for table `species` -- INSERT INTO `species` (`species_id`, `species`) VALUES (1, 'Pas'), (2, 'Macka'), (3, 'Glodavac'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'auto incrementing user_id of each user, unique index', `user_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'user''s name, unique', `user_password_hash` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'user''s password in salted and hashed format', `user_email` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'user''s email, unique', `user_active` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'user''s activation status', `user_activation_hash` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'user''s email verification hash string', `user_password_reset_hash` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'user''s password reset code', `user_password_reset_timestamp` bigint(20) DEFAULT NULL COMMENT 'timestamp of the password reset request', `user_rememberme_token` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'user''s remember-me cookie token', `user_failed_logins` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'user''s failed login attemps', `user_last_failed_login` int(10) DEFAULT NULL COMMENT 'unix timestamp of last failed login attempt', `user_registration_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `user_registration_ip` varchar(39) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '0.0.0.0', PRIMARY KEY (`user_id`), UNIQUE KEY `user_name` (`user_name`), UNIQUE KEY `user_email` (`user_email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='user data' AUTO_INCREMENT=40 ; -- -- -------------------------------------------------------- -- -- Table structure for table `weight` -- CREATE TABLE IF NOT EXISTS `weight` ( `species_id` int(10) NOT NULL, `weight` varchar(50) CHARACTER SET latin1 NOT NULL, KEY `species_id` (`species_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `weight` -- INSERT INTO `weight` (`species_id`, `weight`) VALUES (1, 'do 4 kg'), (1, '4-11 kg'), (1, '11-22 kg'), (1, '22-35 kg'), (1, 'iznad 35 kg'), (2, 'domaca'), (2, 'perzijska'), (2, 'sijamska'), (3, 'zamorac'), (3, 'hrcak'), (3, 'zec'); -- -- Constraints for dumped tables -- -- -- Constraints for table `age` -- ALTER TABLE `age` ADD CONSTRAINT `age_ibfk_1` FOREIGN KEY (`species_id`) REFERENCES `species` (`species_id`); -- -- Constraints for table `weight` -- ALTER TABLE `weight` ADD CONSTRAINT `weight_ibfk_1` FOREIGN KEY (`species_id`) REFERENCES `species` (`species_id`); /*!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 */;
DROP PROCEDURE IF EXISTS sp_day_update; CREATE PROCEDURE `sp_day_update`(IN `p_day_id` bigINT) LANGUAGE SQL NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER COMMENT '' BEGIN DECLARE v_max_t DECIMAL (5,2); DECLARE dt_max_t TIME; DECLARE v_min_t DECIMAL (5,2); DECLARE dt_min_t TIME; DECLARE v_avg_t DECIMAL (5,2); DECLARE v_avg_h DECIMAL (3,1); DECLARE v_avg_ws DECIMAL (3,1); DECLARE v_max_wg INTEGER; DECLARE dt_max_wg TIME; DECLARE v_sum_r DECIMAL (3,1); DECLARE wd_count INT; DECLARE wd SMALLINT(6); SELECT temperature, time INTO v_max_t, dt_max_t FROM archive WHERE day_id = p_day_id ORDER BY temperature DESC LIMIT 0,1; SELECT temperature, time INTO v_min_t, dt_min_t FROM archive WHERE day_id = p_day_id ORDER BY temperature ASC LIMIT 0,1; SELECT avg(temperature) INTO v_avg_t FROM archive WHERE day_id = p_day_id; SELECT avg(humidity) INTO v_avg_h FROM archive WHERE day_id = p_day_id; SELECT avg(wind_speed) INTO v_avg_ws FROM archive WHERE day_id = p_day_id; SELECT wind_gust, time INTO v_max_wg, dt_max_wg FROM archive WHERE day_id = p_day_id ORDER BY wind_gust DESC LIMIT 0,1; SELECT sum(rain) INTO v_sum_r FROM archive WHERE day_id = p_day_id; SELECT count(*), wind_direction INTO wd_count, wd FROM archive WHERE day_id = p_day_id ORDER BY count(*) DESC LIMIT 0,1; UPDATE days SET max_temperature = CASE WHEN v_max_t >= max_temperature THEN v_max_t ELSE max_temperature END, max_temperaure_time = CASE WHEN v_max_t >= max_temperature THEN dt_max_t ELSE max_temperaure_time END, min_temperature = CASE WHEN v_min_t <= min_temperature THEN v_min_t ELSE min_temperature END, min_temperaure_time = CASE WHEN v_min_t <= min_temperature THEN dt_min_t ELSE min_temperaure_time END, avg_temperature = v_avg_t, avg_humidity = v_avg_h, max_windgust = CASE WHEN v_max_wg >= max_windgust THEN v_max_wg ELSE max_windgust END, max_windgust_time = CASE WHEN v_max_wg >= max_windgust THEN dt_max_wg ELSE max_windgust_time END, avg_windspeed = v_avg_ws, wind_direction = wd, sum_rain = v_sum_r WHERE id = p_day_id; END
-- Now, create and use an alias to shorten the following query (which is different than the one in Derek's previous video) that has multiple window functions. Name the alias account_year_window, which is more descriptive than main_window in the example above. SELECT id, account_id, DATE_TRUNC('year',occurred_at) AS year, DENSE_RANK() OVER w1 AS dense_rank, total_amt_usd, SUM(total_amt_usd) OVER w1 AS sum_total_amt_usd, COUNT(total_amt_usd) OVER w1 AS count_total_amt_usd, AVG(total_amt_usd) OVER w1 AS avg_total_amt_usd, MIN(total_amt_usd) OVER w1 AS min_total_amt_usd, MAX(total_amt_usd) OVER w1 AS max_total_amt_usd FROM orders WINDOW w1 AS (PARTITION BY account_id ORDER BY DATE_TRUNC('year',occurred_at));
-- SELECT CURRENT_DATE + s.a AS dates -- FROM generate_series(0,14,7) as s(a); -- DROP TABLE IF EXISTS crsp.trading_dates CASCADE; DROP TABLE IF EXISTS crsp.trading_dates CASCADE; CREATE TABLE crsp.trading_dates AS SELECT date, (rank() OVER (ORDER BY date))::integer AS td FROM (SELECT DISTINCT DATE FROM crsp.dsi) AS a; CREATE INDEX ON crsp.trading_dates (date); CREATE INDEX trading_dates_td_idx ON crsp.trading_dates (td); CLUSTER crsp.trading_dates USING trading_dates_td_idx; ANALYZE crsp.trading_dates; DROP VIEW IF EXISTS crsp.all_dates; CREATE VIEW crsp.all_dates AS SELECT anncdate::date FROM generate_series((SELECT min(date) FROM crsp.trading_dates)::timestamp, (SELECT max(date) FROM crsp.trading_dates), '1 day') AS anncdate; DROP TABLE IF EXISTS crsp.anncdates; CREATE TABLE crsp.anncdates AS SELECT a.anncdate, min(td) OVER w AS td, min(date) OVER w AS date FROM crsp.all_dates AS a LEFT JOIN crsp.trading_dates AS b ON b.date = a.anncdate WINDOW w AS (ORDER BY anncdate ROWS BETWEEN CURRENT ROW AND 7 FOLLOWING) ORDER BY anncdate; -- CREATE INDEX ON crsp.anncdates (td); CREATE INDEX anncdates_anncdate_idx ON crsp.anncdates (anncdate); -- CREATE INDEX ON crsp.anncdates (date); CLUSTER crsp.anncdates USING anncdates_anncdate_idx; ANALYZE crsp.anncdates; SELECT * FROM crsp.anncdates WHERE date IS NULL; CREATE INDEX ON crsp.anncdates (anncdate);
-- High coverage SET SEARCH_PATH TO markus; DROP TABLE IF EXISTS q7; -- You must not change this table definition. CREATE TABLE q7 ( ta varchar(100) ); -- You may find it convenient to do this for each of the views -- that define your intermediate steps. (But give them better names!) DROP VIEW IF EXISTS grader_pool CASCADE; DROP VIEW IF EXISTS ideal_case CASCADE; DROP VIEW IF EXISTS reality_case CASCADE; DROP VIEW IF EXISTS difference CASCADE; DROP VIEW IF EXISTS pool CASCADE; DROP VIEW IF EXISTS group_mcount CASCADE; DROP VIEW IF EXISTS group_mcount_assigned CASCADE; DROP VIEW IF EXISTS studentCount CASCADE; DROP VIEW IF EXISTS pool2 CASCADE; DROP VIEW IF EXISTS answer CASCADE; -- Define views for your intermediate steps here. -- Question Seven -- Report the username of all graders who have been assigned at least one group (the group could -- be solo or larger) for every assignment and have been -- assigned to grade every student (whether in solo or larger group) on at least one assignment -- Find the TA who have been assigned at least one group for every assignment create view grader_pool as select username from MarkusUser where type = 'TA' or type = 'instructor'; -- Find the TA who have been assigned at least one group for every assignment -- Ideal case: every ta was assigned at least one group for every assignment create view ideal_case as select distinct username, assignment_id from grader_pool, Assignment; -- Find the reality of the assignments that the TAs were actually assigned to create view reality_case as select distinct username, assignment_id from AssignmentGroup natural join Grader; -- Find the failures of TAs that did not mark all assignment create view difference as (select * from ideal_case) except (select * from reality_case); -- Take the difference again to find the TAs who as assigned at least -- one group for every assginment create view pool as (select distinct username from grader_pool) except (select distinct username from difference); -- Find the number of students that each TA marked for each assignment -- Find the students that the TA marked create view group_mcount as select distinct assignment_id, group_id, username as student from AssignmentGroup natural join Membership; -- Find the number of students that the TA marked across all assignments create view group_mcount_assigned as select username, count(distinct student) as total_members from group_mcount natural join Grader natural join pool group by username; -- Find the total number of students exist in MarkUs create view studentCount as select count(*) as totalStudent from MarkusUser where type = 'student'; -- If the TA did not mark every student, then the count would not match create view pool2 as select distinct username from group_mcount_assigned, studentCount where total_members = totalStudent; -- The answer would be the TAs who marked every assignment as well as every student create view answer as (select username as ta from pool) intersect (select username as ta from pool2); -- Final answer. INSERT INTO q7 (select * from answer); -- put a final query here so that its results will go into the table.
create database herbario; insert into cadastros(nome, senha, nivel) values ('admin', '1234', 2); select *from cadastros; create table cadastros( id int primary key auto_increment, nome varchar(50) not null, senha varchar(20) not null, nivel int not null ); select * from exsicatas where especie LIKE '%sda%'; drop table exsicatas; create table exsicatas( familia varchar(200), genero varchar(200), especie varchar(200), nomeVulgar varchar(200), localColeta varchar(200), coletor varchar(200), dataColeta varchar(15), numeroTombamento int primary key auto_increment, observacoes varchar(2000) ); select * from exsicatas; insert into exsicatas (familia, genero, especie, nomeVulgar, localColeta, coletor, dataColeta) values ('sasdasdfsadfasddsfsdafdsfasfsa sdfsdafsdafsdafsda', 'adfa', 'ewqrwrw', 'fasfs', 'dsfasdfs', 'sdafsdfsa', '23421332 ');
--PROBLEM 05 --Write a function ufn_GetSalaryLevel(@salary DECIMAL(18,4)) --that receives salary of an employee and returns the level of the salary. --• If salary is < 30000 return “Low” --• If salary is between 30000 and 50000 (inclusive) return “Average” --• If salary is > 50000 return “High” CREATE FUNCTION ufn_GetSalaryLevel(@salary DECIMAL(18,4)) RETURNS CHAR(10) BEGIN IF(@salary<30000) RETURN 'Low' ELSE IF (@salary>=30000 AND @salary<=50000) RETURN 'Average' RETURN 'High' END --TEST SELECT FirstName+' '+LastName as FUll_NAME ,Salary ,dbo.ufn_GetSalaryLevel(Salary) AS SalaryLevel FROM Employees
-- scott 계정, create 연습 /* 테이블 이름: customers(고객) 컬럼: 1) cust_id: 고객 아이디. 8 ~ 20 byte의 문자열. primary key. 2) cust_pw: 고객 비밀번호. 8 ~ 20 byte의 문자열. not null. 3) cust_email: 고객 이메일. 100 byte 문자열. 4) cust_gender: 고객 성별. 1자리 정수. 기본값 0. (0, 1, 2) 중 1개 값만 가능. 5) cust_age: 고객 나이. 3자리 정수. 기본값 0. 0 이상 200 이하의 정수만 가능. */ create table customers ( cust_id varchar2(20) constraint pk_customers primary key constraint ck_cust_id check (lengthb(cust_id) >= 8), cust_pw varchar2(20) not null constraint ck_cust_pw check (lengthb(cust_pw) >= 8), cust_email varchar2(100), cust_gender number(1) default 0 constraint ck_cust_gender check (cust_gender in (0, 1, 2)), cust_age number(3) default 0 constraint ck_cust_age check (cust_age between 0 and 200) ); create table customers2 ( cust_id varchar2(20), cust_pw varchar2(20) not null, cust_email varchar2(100), cust_gender number(1) default 0, cust_age number(3) default 0, constraint pk_customers2 primary key (cust_id), constraint ck_cust_id2 check (lengthb(cust_id) >= 8), constraint ck_cust_pw2 check (lengthb(cust_pw) >= 8), constraint ck_cust_gender2 check (cust_gender in (0, 1, 2)), constraint ck_cust_age2 check (cust_age between 0 and 200) ); /* 테이블 이름: orders(주문) 1) order_id: 주문번호. 4자리 정수. primary key. 2) order_date: 주문 날짜. 기본값은 현재 시간. 3) order_method: 주문 방법. 8 byte 문자열. ('online', 'offline') 중 1개 값만 가능. 4) cust_id: 주문 고객 아이디. 20 byte 문자열. not null. customers(cust_id)를 참조. */ create table orders ( order_id number(4) constraint pk_order_id primary key, order_date date default sysdate, order_method varchar2(8) constraint ck_order_method check (order_method in ('online', 'offline')), cust_id varchar2(20) not null constraint fk_cust_id references customers(cust_id) ); create table orders2 ( order_id number(4), order_date date default sysdate, order_method varchar2(8), cust_id varchar2(20) not null, constraint pk_order_id2 primary key (order_id), constraint ck_order_method2 check (order_method in ('online', 'offline')), constraint fk_cust_id2 foreign key (cust_id) references customers(cust_id) ); create table ex08 ( col_a number(2) constraint ck_1 check (col_a >= 0) constraint ck_2 check (col_a < 50), col_b varchar2(10) ); create table ex09 ( col_a number(2) constraint ck_ex09_1 check (col_a >= 0 and col_a < 50), col_b varchar2(10) ); -- insert ~ select 구문 -- emp 테이블에서 이름, 직책, 급여, 수당을 검색해서 bonus 테이블에 삽입. insert into bonus select ename, job, sal, comm from emp; select * from bonus; -- 사번, 이름, 부서이름, 직책, 급여를 저장할 수 있는 테이블 생성. create table emp_dept ( empno number(4, 0), -- 4자리 정수(소수점 허용 안함) ename varchar2(10 byte), dname varchar2(14 byte), job varchar2(9 byte), sal number(7, 2) -- 7자리 숫자(소수점 이하 2자리까지) ); -- emp와 dept 테이블을 사용해서 테이블의 값들을 insert. insert into emp_dept select e.empno, e.ename, d.dname, e.job, e.sal from emp e join dept d on e.deptno = d.deptno; select * from emp_dept; -- create table ~ as select 구문 -- 사번, 이름, 급여를 저장하는 테이블 생성, emp 테이블의 레코드들을 복사 create table ex_emp3 as select empno, ename, sal from emp; describe ex_emp3; select * from ex_emp3; commit;
CREATE TABLE DeviceRequest ( id uniqueidentifier NOT NULL PRIMARY KEY, groupIdentifier_Identifier uniqueidentifier FOREIGN KEY REFERENCES Identifier(id), [status] nvarchar(255), intent nvarchar(255) NOT NULL, [priority] nvarchar(255), -- code[x]: Type[1..1] subject_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id), encounter_Reference uniqueidentifier FOREIGN KEY REFERENCES Reference(id), -- occurence[x]: Type[0..1] authoredOn datetime, requester_Reference uniqueidentifier FOREIGN KEY REFERENCES Reference(id), performerType_CodeableConcept uniqueidentifier FOREIGN KEY REFERENCES CodeableConcept(id), performer_Reference uniqueidentifier FOREIGN KEY REFERENCES Reference(id), ); CREATE TABLE DeviceRequestIdentifier ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Identifier uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Identifier(id), CONSTRAINT PK_DeviceRequestIdentifier PRIMARY KEY (id_DeviceRequest, id_Identifier) ); CREATE TABLE DeviceRequestInstantiatesCanonical ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Canonical uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Canonical(id), CONSTRAINT PK_DeviceRequestInstantiatesCanonical PRIMARY KEY (id_DeviceRequest, id_Canonical) ); CREATE TABLE DeviceRequestInstantiatesUri ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Uri uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Uri(id), CONSTRAINT PK_DeviceRequestInstantiatesUri PRIMARY KEY (id_DeviceRequest, id_Uri) ); CREATE TABLE DeviceRequestBasedOn ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id), CONSTRAINT PK_DeviceRequestBasedOn PRIMARY KEY (id_DeviceRequest, id_Reference) ); CREATE TABLE DeviceRequestPriorRequest ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id), CONSTRAINT PK_DeviceRequestPriorRequest PRIMARY KEY (id_DeviceRequest, id_Reference) ); CREATE TABLE DeviceRequestReasonCode ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_CodeableConcept uniqueidentifier NOT NULL FOREIGN KEY REFERENCES CodeableConcept(id), CONSTRAINT PK_DeviceRequestReasonCode PRIMARY KEY (id_DeviceRequest, id_CodeableConcept) ); CREATE TABLE DeviceRequestReasonReference ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id), CONSTRAINT PK_DeviceRequestReasonReference PRIMARY KEY (id_DeviceRequest, id_Reference) ); CREATE TABLE DeviceRequestInsurance ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id), CONSTRAINT PK_DeviceRequestInsurance PRIMARY KEY (id_DeviceRequest, id_Reference) ); CREATE TABLE DeviceRequestSupportingInfo ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id), CONSTRAINT PK_DeviceRequestSupportingInfo PRIMARY KEY (id_DeviceRequest, id_Reference) ); CREATE TABLE DeviceRequestNote ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Annotation uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Annotation(id), CONSTRAINT PK_DeviceRequestNote PRIMARY KEY (id_DeviceRequest, id_Annotation) ); CREATE TABLE DeviceRequestRelevantHistory ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_Reference uniqueidentifier NOT NULL FOREIGN KEY REFERENCES Reference(id), CONSTRAINT PK_DeviceRequestRelevantHistory PRIMARY KEY (id_DeviceRequest, id_Reference) ); -- Hjelpetabeller og tilhørende relasjoner CREATE TABLE DeviceRequestParameter_HT ( id uniqueidentifier NOT NULL PRIMARY KEY, code_CodeableConcept uniqueidentifier FOREIGN KEY REFERENCES CodeableConcept(id), -- value[x]: Type[0..1] ); CREATE TABLE DeviceRequestParameter ( id_DeviceRequest uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequest(id), id_DeviceRequestParameter_HT uniqueidentifier NOT NULL FOREIGN KEY REFERENCES DeviceRequestParameter_HT(id), CONSTRAINT PK_DeviceRequest PRIMARY KEY (id_DeviceRequest, id_DeviceRequestParameter_HT) );
DROP TABLE IF EXISTS Packages; DROP TABLE IF EXISTS Users; DROP TABLE IF EXISTS PeersMap; CREATE TABLE Packages ( pName TEXT UNIQUE NOT NULL, pDesc TEXT, pVersion TEXT, pAuthor TEXT, pDependences TEXT, pFiles TEXT NOT NULL ); CREATE TABLE Users ( IP TEXT UNIQUE NOT NULL ); CREATE TABLE PeersMap ( pName TEXT NOT NULL, IP TEXT NOT NULL, UNIQUE(pName,IP) );
DROP TABLE IF EXISTS public.user; CREATE TABLE public.user ( id SERIAL PRIMARY KEY NOT NULL, username character varying NOT NULL, email character varying NOT NULL, firstname character varying NOT NULL, jumpcloud_id character varying NOT NULL );
UPDATE behandling SET resultat='ENDRET' WHERE resultat='ENDRET_OG_FORTSATT_INNVILGET';
SELECT count(*) AS 'movies' FROM member_history WHERE date BETWEEN '2006-10-30' AND '2007-07-27' OR month(date)=12 AND day(date)=24;
 CREATE view [DW].[Wasteless] as SELECT [WasteSID] ,a.[DateSID] ,[ProductionWasteKg] ,[LineWasteKg] ,[PlateWasteKg] ,[WasteTotalKg] ,a.[LocationSID] ,[MealCount] ,[SpecialMealCount] ,[MealTotal] ,[Forecast_MealTotal] ,[Forecast_SpecialMealCount] ,[Forecast_MealCount] ,[Forecast_ProductionWasteKg] ,[Forecast_LineWasteKg] ,[Forecast_PlateWasteKg] ,[Forecast_WasteTotalKg] , b.Menu FROM [DW].[FacWasteless] a left join DW.FacMenu b on a.LocationSID = b.LocationSID and a.DateSID = b.DateSID where (coalesce(a.MealTotal,0) > 0) and a.locationsid = 1
/* * * Clean automation rules items logs for Jira Service Management * it helps for the large installations * Purpose: during migration or on large installation those logs eat quite a lot of resources. * */ select count(*) from "AO_9B2E3B_EXEC_RULE_MSG_ITEM"; -- clean exact table truncate "AO_9B2E3B_EXEC_RULE_MSG_ITEM"; select count(*) from "AO_9B2E3B_IF_COND_EXECUTION"; -- clean exact table truncate "AO_9B2E3B_IF_COND_EXECUTION" CASCADE ; -- remove all history of running truncate "AO_9B2E3B_RULE_EXECUTION" CASCADE ;
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; CREATE TABLE IF NOT EXISTS `user` ( `id` int(12) NOT NULL AUTO_INCREMENT, `fname` varchar(30) NOT NULL, `lname` varchar(30) NOT NULL, `email` varchar(60) NOT NULL, `password` varchar(40) NOT NULL, `status` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
create or replace PACKAGE pkRegistroLvl3 is procedure pRegistrarSCreacion (observacion VARCHAR2 , clientes_cedula NUMBER, tipoProducto VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2); procedure pRegistrarSModificacion (clientes_cedula NUMBER , clientesxproductos_id VARCHAR2, tipoProducto VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2); procedure pRegistrarSCancelacion (observacion VARCHAR2, clientes_cedula NUMBER , clientesxproductos_id VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2); procedure pRegistrarSDanio (observacion VARCHAR2, tipoanomalia VARCHAR2, clientes_cedula NUMBER, clientesxproductos_id VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2); procedure pRegistrarSReclamo (observacion VARCHAR2 , clientes_cedula NUMBER, clientesxproductos_id VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2); end pkRegistroLvl3; / create or replace PACKAGE body pkRegistroLvl3 is --creacion procedure pRegistrarSCreacion (observacion VARCHAR2 , clientes_cedula NUMBER, tipoProducto VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2) is begin pkRegistro.pRegistrarSCreacion(observacion, clientes_cedula, tipoProducto); code := 0; msj := 'Solicitud de creación realizada con éxito'; exception WHEN others then code:=SQLCODE; msj:=SQLERRM; end; --Modificacion procedure pRegistrarSModificacion (clientes_cedula NUMBER , clientesxproductos_id VARCHAR2, tipoProducto VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2) is begin pkRegistro.pRegistrarSModificacion(clientes_cedula, clientesxproductos_id, tipoProducto); code := 0; msj := 'Solicitud de modificacion creada con éxito'; exception WHEN others then code:=SQLCODE; msj:=SQLERRM; end; --cancelacion procedure pRegistrarSCancelacion (observacion VARCHAR2, clientes_cedula NUMBER , clientesxproductos_id VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2) is begin pkRegistro.pRegistrarSCancelacion(observacion, clientes_cedula, clientesxproductos_id); code := 0; msj := 'Solicitud de cancelación creada con éxito'; exception WHEN others then code:=SQLCODE; msj:=SQLERRM; end; --Daño procedure pRegistrarSDanio (observacion VARCHAR2, tipoanomalia VARCHAR2, clientes_cedula NUMBER, clientesxproductos_id VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2) is begin pkRegistro.pRegistrarSDanio(observacion, tipoanomalia, clientes_cedula, clientesxproductos_id); code := 0; msj := 'Solicitud de daño creada con éxito'; exception WHEN others then code:=SQLCODE; msj:=SQLERRM; end; --Reclamo procedure pRegistrarSReclamo (observacion VARCHAR2 , clientes_cedula NUMBER, clientesxproductos_id VARCHAR2, code OUT NUMBER, msj OUT VARCHAR2) is begin pkRegistro.pRegistrarSReclamo(observacion, clientes_cedula, clientesxproductos_id); code := 0; msj := 'Reclamo creado con éxito'; exception WHEN others then code:=SQLCODE; msj:=SQLERRM; end; end pkRegistroLvl3;
drop database if exists fuckops; create database fuckops; use fuckops; create table users ( id int not null auto_increment, username varchar(32) not null unique, password varchar(64) not null, email varchar(32) not null unique, role varchar(32), status int, login_ip varchar(64), login_time timestamp, primary key (id), key (username) ); create table hosts( id int not null auto_increment, hostname varchar(32) not null, ip varchar(64) not null unique, environment int not null, /*服务器所在环境,生产环境为1,测试环境为0*/ cpu VARCHAR(64), memory VARCHAR(32), disk VARCHAR(32), os varchar(32), kernel varchar(32), status int, /*已添加监控为1,未添加为0*/ primary key (id), key (ip) );
IF EXISTS (SELECT * FROM sys.objects WHERE type in (N'FN', N'IF', N'TF', N'FS', N'FT') AND name = 'fnc_FormatRemovalPhone' ) DROP FUNCTION fnc_FormatRemovalPhone GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUNCTION [dbo].[fnc_FormatRemovalPhone] ( @phone varchar(100), @MatchExpression varchar(100) = '^0-9' ) RETURNS varchar(100) AS BEGIN SET @MatchExpression = '%['+@MatchExpression+']%' DECLARE @newphone varchar(100); SET @newphone = ISNULL(@phone,'') IF @phone IS NOT NULL BEGIN WHILE PatIndex(@MatchExpression, @newphone) > 0 SET @newphone = Stuff(@newphone, PatIndex(@MatchExpression, @newphone), 1, '') END RETURN @newphone END GO
drop database sonaar; create database sonaar default charset "UTF8"; use sonaar; DROP TABLE IF EXISTS `Image`; CREATE TABLE `Image` ( `ImageId` INT (11) NOT NULL AUTO_INCREMENT, `ClarifaiId` VARCHAR (255) NOT NULL, `ClarifaiConcepts` TEXT NOT NULL, `Text` TEXT, `CreationDate` DATETIME NOT NULL, PRIMARY KEY (`ImageId`), UNIQUE KEY `ImageId_UNIQUE` (`ImageId`), UNIQUE KEY `ClarifaiId_UNIQUE` (`ClarifaiId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `AltText`; CREATE TABLE `AltText` ( `AltTextId` INT (11) NOT NULL AUTO_INCREMENT, `ImageId` INT (11) NOT NULL, `AltText` TEXT NOT NULL, `Keywords` TEXT NOT NULL, `Language` VARCHAR(10) NOT NULL, `Counter` INT (11) DEFAULT 1, `UserId` VARCHAR (255), `CreationDate` DATETIME NOT NULL, `Quality` DECIMAL(6,5) NOT NULL DEFAULT '0.00000', PRIMARY KEY (`AltTextId`), UNIQUE KEY `AltTextId_UNIQUE` (`AltTextId`), KEY `ATImageId_fk` (`ImageId`), CONSTRAINT `ATImageId_fk` FOREIGN KEY (`ImageId`) REFERENCES `Image` (`ImageId`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `Counter`; CREATE TABLE `Counter` ( `Suggestion` INT (11) DEFAULT 0, `Authoring` INT (11) DEFAULT 0, `Consumption` INT (11) DEFAULT 0, `SuggestionLastUpdated` DATETIME NOT NULL, `AuthoringLastUpdated` DATETIME NOT NULL, `ConsumptionLastUpdated` DATETIME NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `Log`; CREATE TABLE `Log` ( `LogId` INT (11) NOT NULL AUTO_INCREMENT, `UserId` VARCHAR (255) NOT NULL, `Platform` VARCHAR (255) NOT NULL, `SocialMedia`VARCHAR (255), `RequestType` VARCHAR (255) NOT NULL, `AltTextContribution` TINYINT (1) NOT NULL DEFAULT 0, `CreationDate` DATETIME NOT NULL, PRIMARY KEY (`LogId`), UNIQUE KEY `LogId_UNIQUE` (`LogId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into migration_history (version, notes) values ('201505272300', 'Initial'); -- Типы срока договора: дата окончания или количество дней. create type term_types as enum ('date', 'length'); -- Единицы измерения срока договора в днях: календарные дни, рабочие дни. create type term_length_units as enum ('calendar', 'working'); -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Договор create table contract ( contract_id serial not null, document_id integer not null, provider_id integer null default null, consumer_id integer null default null, subject text null default null, payment money null default null, term_type term_types null default null, term_date date null default null, term_length integer null default null, term_length_unit term_length_units null default null, constraint contract_primary_key primary key (contract_id) ); comment on table contract is 'Договор. Связывает двух контрагентов договорными обязательствами.'; comment on column contract.provider_id is 'Номер контрагента исполнителя'; comment on column contract.consumer_id is 'Номер контрагента заказчика'; comment on column contract.subject is 'Предмет договора. Произвольный текст.'; comment on column contract.payment is 'Сумма договора.'; comment on column contract.term_type is 'Тип срока договора: дата окончания или количество дней.'; comment on column contract.term_date is 'Дата окончания договора'; comment on column contract.term_length is 'Срок договора в днях'; comment on column contract.term_length_unit is 'Единица измерения срока договора в днях: календарные дни, рабочие дни.'; alter table contract add constraint contract_document foreign key (document_id) references document (document_id) on delete cascade on update cascade; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Контрагент create table contractor ( contractor_id serial not null, document_id integer not null, constraint contractor_primary_key primary key (contractor_id) ); comment on table contractor is 'Контрагент. Определены три типа контрагентов: физлицо, юрлицо, ИП.'; alter table contractor add constraint contractor_document foreign key (document_id) references document (document_id) on delete cascade on update cascade; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Индивидуальный предприниматель create table businessman ( businessman_id serial not null, contractor_id integer not null, individual_id integer not null, constraint businessman_primary_key primary key (businessman_id) ); comment on table businessman is 'Индивидуальный предприниматель (контрагент).'; comment on column businessman.individual_id is 'Номер физического лица.'; alter table businessman add constraint businessman_contractor foreign key (contractor_id) references contractor (contractor_id) on delete cascade on update cascade; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Физическое лицо create table individual ( individual_id serial not null, contractor_id integer not null, first_name varchar(200) null default null, surname varchar(200) null default null, patronymic varchar(200) null default null, constraint individual_primarey_key primary key (individual_id) ); comment on table individual is 'Физическое лицо (контрагент).'; comment on column individual.first_name is 'Имя'; comment on column individual.surname is 'Фамилия'; comment on column individual.patronymic is 'Отчество'; alter table individual add constraint individual_contractor foreign key (contractor_id) references contractor (contractor_id) on delete cascade on update cascade; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Форма собственности create table ownership_type ( ownership_type_id serial not null, title varchar(200) not null, title_short varchar(100) not null, constraint ownership_type_primary_key primary key (ownership_type_id) ); comment on table ownership_type is 'Форма собственности'; comment on column ownership_type.title is 'Наименование'; comment on column ownership_type.title_short is 'Сокращенное наименование'; insert into ownership_type (title, title_short) values ('Общество с ограниченной ответственностью', 'ООО'); insert into ownership_type (title, title_short) values ('Закрытое акционерное общество', 'ЗАО'); insert into ownership_type (title, title_short) values ('Государственное бюджетное учреждение культуры города Москвы', 'ГБУК г. Москвы'); insert into ownership_type (title, title_short) values ('Муниципальное учреждение здравоохранения', 'МУЗ'); insert into ownership_type (title, title_short) values ('Товарищество собственников жилья', 'ТСЖ'); -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Юридическое лицо create table legal ( legal_id serial not null, contractor_id integer not null, title varchar(200) null default null, title_short varchar(200) null default null, ownership_type_id integer null default null, constraint legal_primary_key primary key (legal_id) ); comment on table legal is 'Юридическое лицо (контрагент).'; comment on column legal.title is 'Наименование'; comment on column legal.ownership_type_id is 'Номер формы собственности'; alter table legal add constraint legal_contractor foreign key (contractor_id) references contractor (contractor_id) on delete cascade on update cascade; alter table legal add constraint legal_ownership_type foreign key (ownership_type_id) references ownership_type (ownership_type_id) on delete cascade on update cascade; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Платежное поручение create table payment_order ( payment_order_id serial not null, document_id integer not null, sender_id integer null default null, recipient_id integer null default null, payment money null default null, constraint payment_order_primary_key primary key (payment_order_id) ); comment on table payment_order is 'Платежное поручение'; comment on column payment_order.sender_id is 'Номер контрагента плательщика'; comment on column payment_order.recipient_id is 'Номер контрагента получателя'; comment on column payment_order.payment is 'Сумма'; alter table payment_order add constraint payment_order_document foreign key (document_id) references document (document_id) on delete cascade on update cascade;
-- https://www.urionlinejudge.com.br/judge/en/problems/view/2605 select products.name, providers.name from products join providers on providers.id = products.id_providers join categories c on products.id_categories = c.id where c.id = 6
/* 500 CacheException error thrown during upgrade/restore of Jira server https://confluence.atlassian.com/jirakb/500-cacheexception-error-thrown-during-upgrade-restore-of-jira-server-800858895.html https://jira.atlassian.com/browse/JRASERVER-70651 */ SELECT * FROM nodeassociation WHERE source_node_entity = 'Project' AND source_node_id NOT IN (SELECT id FROM project); -- delete from nodeassociation where source_node_entity = 'Project' and source_node_id not in (select id from project);
CREATE procedure sp_ser_loadpersonnelinfo(@PersonnelID nvarchar(50)) as Select Personnel_Item_Category.CategoryID,Category_Name from Personnel_Item_Category,ItemCategories where PersonnelID = @PersonnelID and ItemCategories.CategoryID = Personnel_Item_Category.CategoryID
--Problem 11 SELECT * FROM( SELECT EmployeeID ,FirstName ,LastName ,Salary ,DENSE_RANK() OVER(PARTITION BY Salary ORDER BY EmployeeID) AS [RANK] FROM Employees WHERE Salary BETWEEN 10000 AND 50000 ) AS [TABLE] WHERE [RANK]=2 ORDER BY SALARY DESC
DROP DATABASE ExamManagement; CREATE DATABASE ExamManagement; USE ExamManagement; CREATE TABLE STUDENT( ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, FIRSTNAME VARCHAR(40) NOT NULL, LASTNAME VARCHAR(40) NOT NULL, EMAIL VARCHAR(40) NOT NULL, PASSWORD VARCHAR(40) NOT NULL ); CREATE TABLE ADMIN( USERNAME VARCHAR(40) PRIMARY KEY NOT NULL, FIRSTNAME VARCHAR(40) NOT NULL, LASTNAME VARCHAR(40) NOT NULL, EMAIL VARCHAR(40) NOT NULL, PASSWORD VARCHAR(40) NOT NULL, EPASSWORD VARCHAR(40) NOT NULL ); CREATE TABLE EMAIL( EMAIL VARCHAR(40) NOT NULL, PASSWORD VARCHAR(40) NOT NULL ); CREATE TABLE EXAMS( ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, TITLE VARCHAR(200) NOT NULL, TOTALQUESTION INT NOt NULL ); CREATE TABLE CURRENTEXAM( ID INT PRIMARY KEY, TIME INT ); INSERT INTO ADMIN VALUES('admin','admin','admin','admin','admin','admin'); INSERT INTO EMAIL VALUES('admin','admin'); -- TESTS -- SELECT COUNT(*) FROM ADMIN WHERE USERNAME='ADMIN' AND PASSWORD='ADMIN'; -- SELECT * FROM ADMIN WHERE USERNAME='ADMIN' AND PASSWORD='ADMIN'; -- INSERT INTO EXAMS(TITLE,TOTALQUESTION) VALUES('JAVA',10); -- DELETE FROM CURRENTEXAM; -- INSERT INTO CURRENTEXAM VALUES(2,50); -- INSERT INTO STUDENT(FIRSTNAME,LASTNAME,EMAIL,PASSWORD) values('BHARGAB','HAZARIKA','MAXY@HELL.COM','GGYYGUH'); -- SELECT * FROM EXAMS WHERE ID=2 -- UPDATE EXAMS SET TITLE='NEW TITLE',TOTALQUESTION=123 WHERE ID=1; -- DELETE FROM EXAMS WHERE ID=7; -- CREATE TABLE EXAM_1(ID INT PRIMARY KEY,Q VARCHAR(150),A VARCHAR(100),B VARCHAR(100),C VARCHAR(100),D VARCHAR(100),CA VARCHAR(5)); -- INSERT INTO EXAM_5 VALUES(1,'q','a','b','c','d','a');
SELECT * FROM Angela.STEP3_17_16 SELECT PROJYEAR, DELETE_, SUM(UNITS) FROM Angela.STEP4_17_16 GROUP BY PROJYEAR, DELETE_ -- CREATE A TABLE ONLY HAS NON-DELETED PERMIT SELECT * INTO Angela.STEP4_17_16 FROM ANGELA.STEP3_17_16 WHERE DELETE_ is null OR DELETE_ = 0 -- update issue year UPDATE Angela.STEP4_17_16 SET ISSUEDYEAR = YEAR(ISSUED) FROM Angela.STEP4_17_16 -- VALIDATE SELECT ISSUEDYEAR, COUNT(*) FROM Angela.STEP4_17_16 GROUP BY ISSUEDYEAR -- update null value county UPDATE Angela.STEP4_17_16 SET CNTY = 33 FROM Angela.STEP4_17_16 WHERE JURIS17 = 'LAKEFORESTPARK' UPDATE Angela.STEP4_17_16 SET CNTY = 33 FROM Angela.STEP4_17_16 WHERE JURIS17 = 'CLYDEHILL' UPDATE Angela.STEP4_17_16 SET CNTY = 33 FROM Angela.STEP4_17_16 WHERE JURIS17 = 'MERCERISLAND' UPDATE Angela.STEP4_17_16 SET CNTY = 61 FROM Angela.STEP4_17_16 WHERE JURIS17 = 'MILLCREEK' -- validate SELECT * FROM Angela.STEP4_17_16 WHERE CNTY is null -- update CNTY UPDATE Angela.STEP4_17_16 SET CNTY = 035 FROM Angela.STEP4_17_16 WHERE CNTY = 35 UPDATE Angela.STEP4_17_16 SET CNTY = 061 FROM Angela.STEP4_17_16 WHERE CNTY = 61 UPDATE Angela.STEP4_17_16 SET CNTY = 033 FROM Angela.STEP4_17_16 WHERE CNTY = 33 UPDATE Angela.STEP4_17_16 SET CNTY = 053 FROM Angela.STEP4_17_16 WHERE CNTY = 53 -- update TYPE4 UPDATE Angela.STEP4_17_16 SET TYPE4 = CASE WHEN PROJYEAR = 2017 AND TYPE = 111 THEN 'SF' WHEN PROJYEAR = 2017 AND TYPE = '111' THEN 'SF' WHEN PROJYEAR = 2017 AND TYPE = 121 THEN 'MF1-2' WHEN PROJYEAR = 2017 AND TYPE >= 122 AND TYPE <= 123 THEN 'MF3-4' WHEN PROJYEAR = 2017 AND TYPE = 131 THEN 'MF5-9' WHEN PROJYEAR = 2017 AND TYPE >= 132 AND TYPE <= 133 THEN 'MF10-19' WHEN PROJYEAR = 2017 AND TYPE >= 141 AND TYPE <= 143 THEN 'MF20-49' WHEN PROJYEAR = 2017 AND TYPE = 144 THEN 'MF50+' WHEN PROJYEAR = 2017 AND TYPE >= 151 AND TYPE <= 159 THEN 'GQ' WHEN PROJYEAR = 2017 AND TYPE = 170 THEN 'MH' WHEN PROJYEAR = 2017 AND TYPE >= 181 AND TYPE <= 189 THEN 'TL' WHEN PROJYEAR = 2017 AND TYPE = 191 THEN 'MH' WHEN PROJYEAR = 2017 AND TYPE = 192 THEN 'OTH' WHEN PROJYEAR = 2017 AND TYPE = 194 THEN 'MH' WHEN PROJYEAR = 2017 AND TYPE = 199 THEN 'OTH' ELSE '999' END SELECT TYPE, TYPE4, COUNT(UNITS) FROM Angela.STEP4_17_16 WHERE ISSUEDYEAR = 2017 GROUP BY TYPE, TYPE4 SELECT TYPE, TYPE2, TYPE3, TYPE4, UNITS FROM Angela.STEP4_17_16 WHERE TYPE4 = 999 AND ISSUEDYEAR = 2017 select * from information_schema.columns
SELECT * from nikovits.emp; select * from DBA_TABLES; select owner,table_name from DBA_TABLES where owner = 'NIKOVITS'; --1. select owner from DBA_VIEWS where view_name = 'DBA_TABLES'; select owner from DBA_TABLES where table_name = 'DUAL'; --2. select owner from DBA_synonyms where synonym_name = 'DBA_TABLES'; --3. select * from DBA_VIEWS; select * from DBA_OBJECTS; --4. select * from dual; select * from sz1; --HW. select * from dba_tables where owner = 'NIKOVITS'; select max(timestamp) from DBA_OBJECTS where owner ='NIKOVITS' and object_type = 'TABLE'; select object_name, timestamp from DBA_OBJECTS where owner = 'NIKOVITS' and object_type = 'TABLE' and timestamp = (select max(timestamp) from DBA_OBJECTS where owner ='NIKOVITS' and object_type = 'TABLE'); select BYTES from DBA_SEGMENTS where owner = 'NIKOVITS' and segment_type='TABLE' and segment_name=( select object_name from DBA_OBJECTS where owner = 'NIKOVITS' and object_type = 'TABLE' and timestamp = (select max(timestamp) from DBA_OBJECTS where owner ='NIKOVITS' and object_type = 'TABLE')); CREATE OR REPLACE PROCEDURE newest_table(p_user VARCHAR2) IS newest_time VARCHAR2(20); num_bytes NUMBER; newest_table_name VARCHAR2(20); needed_time VARCHAR2(20); BEGIN select object_name,timestamp into newest_table_name , newest_time from DBA_OBJECTS where owner = p_user and object_type = 'TABLE' and timestamp = (select max(timestamp) from DBA_OBJECTS where owner =p_user and object_type = 'TABLE'); select BYTES into num_bytes from DBA_SEGMENTS where owner = p_user and segment_type='TABLE' and segment_name=( select object_name from DBA_OBJECTS where owner = p_user and object_type = 'TABLE' and timestamp = (select max(timestamp) from DBA_OBJECTS where owner =p_user and object_type = 'TABLE')); needed_time := SUBSTR(newest_time,1,4)||'.'|| SUBSTR(newest_time,6,2)||'.'|| SUBSTR(newest_time,9,2)||'.'|| SUBSTR(newest_time,12,2)||':'|| SUBSTR(newest_time,15,2); DBMS_OUTPUT.PUT_LINE('Table_name: '||newest_table_name||' Size: '||num_bytes|| ' bytes ' ||'Created: '||needed_time); END; / set serveroutput on EXECUTE newest_table('NIKOVITS'); EXECUTE check_plsql('newest_table(''NIKOVITS'')');
create or replace view v1_hdsr001_xz as select a.hdde236, nvl(sum(a.de181),0) as de181, nvl(sum(b.de181),0) as zcje, nvl(sum(a.de181),0)-nvl(sum(b.de181),0) as kyje, a.de022, a.de011 from (select de011,de022,hdde236,sum(de181) de181 from hdsr001 group by de011,de022,hdde236) a, (select de011,de022,jsde802,sum(de181) de181 from hdjh001sb group by de011,de022,jsde802) b where a.de011 = b.de011(+) and a.hdde236 = b.jsde802(+) group by a.hdde236, a.de011, a.de022;
SELECT DISTINCT hacker_id , name , sum(d.m) OVER (PARTITION BY hacker_id order by hacker_id) s FROM ( SELECT s.submission_id , s.hacker_id , h.name , s.challenge_id , MAX(s.score) OVER (PARTITION BY s.hacker_id, s.challenge_id order by s.hacker_id, s.challenge_id) as m , ROW_NUMBER() OVER (PARTITION BY s.hacker_id, s.challenge_id order by s.hacker_id, s.challenge_id) as rn FROM Hackers h INNER JOIN Submissions s on h.hacker_id = s.hacker_id WHERE s.score > 0 ) AS d WHERE d.rn = 1 ORDER BY s desc
/* * Purpose: To generate tables for Pheonix system, statement in MySQL. * System: For both Laravel and Cloud Assignments - semester 01 2017 */ USE Phoenix; DROP TABLE Customer_Booking; DROP TABLE Customer_Review; DROP TABLE Customer; DROP TABLE Trip_Booking; DROP TABLE Itinerary; DROP TABLE Trip; DROP TABLE Tour; DROP TABLE Vehicle; CREATE TABLE Vehicle ( Rego_No CHAR(6) NOT NULL, VIN VARCHAR(20) NOT NULL, Make VARCHAR(20) NOT NULL, Model VARCHAR(35) NOT NULL, Year INTEGER NOT NULL, Capacity Smallint NOT NULL, Fuel_Type VARCHAR(8), Equipment VARCHAR(100), License_Required CHAR(2) NOT NULL, CONSTRAINT Vehicle_pk PRIMARY KEY (Rego_No) ); INSERT INTO Vehicle VALUES('JDO682', '90JERN34F9DF3450F', 'Holden', 'Commodore', 2008, 5, 'Petrol', NULL, 'C'); INSERT INTO Vehicle VALUES('AKJ424', '8Y2340JDSNKL9HGS9', 'BCI', 'Fleetmaster 55', 2010, 87, 'Diesel', 'Fire extinguisher, 5 tents, 3 kayaks', 'MR'); INSERT INTO Vehicle VALUES('EIU112', 'SPG4VLEHSDZ98U454', 'Scania', 'K230UB', 2007, 64, 'Diesel', NULL, 'MR'); INSERT INTO Vehicle VALUES('TPO652', '90S8U449S8G9K5N8L', 'Scania', 'K320UB', 2010, 53, 'Diesel', NULL, 'HR'); INSERT INTO Vehicle VALUES('MCN687', 'T3NF8S0D99l9FK6V5', 'BCI', 'Proma', 2011, 35, 'Diesel', 'Fire extinguisher', 'LR'); CREATE TABLE Tour ( Tour_No CHAR(3) NOT NULL, Tour_Name VARCHAR(70) NOT NULL, Description VARCHAR(100) NOT NULL, Duration FLOAT(24), Route_Map VARCHAR(256), CONSTRAINT Tour_pk PRIMARY KEY (Tour_No) ); INSERT INTO Tour VALUES('021', 'Twelve Apostles Drive', 'A drive along the Great Ocean Road to the Twelve Apostles', 28, NULL); INSERT INTO Tour VALUES('047', 'Northeast Wineries Tour', 'A tour to various wineries in North East Victoria', 32, NULL); INSERT INTO Tour VALUES('055', 'Melbourne Sightseeing', 'A drive along the Great Ocean Road to the Twelve Apostles', 3.5, 'C:\Documents\Route_Maps\Melbourne_Sightseeing.png'); CREATE TABLE Trip ( Trip_Id CHAR(6) NOT NULL, Tour_No CHAR(3) NOT NULL, Rego_No CHAR(6) NOT NULL, Departure_Date DATE, Max_Passengers INTEGER NOT NULL, Standard_Amount DECIMAL(6,2), Concession_Amount DECIMAL(6,2), CONSTRAINT Trip_pk PRIMARY KEY (Trip_Id), CONSTRAINT T_Tour_fk FOREIGN KEY (Tour_No) REFERENCES Tour (Tour_No), CONSTRAINT T_Vehicle_fk FOREIGN KEY (Rego_No) REFERENCES Vehicle (Rego_No) ); INSERT INTO Trip VALUES('004572', '055', 'EIU112', '2016-05-15', 62,100,80); INSERT INTO Trip VALUES('004640', '055', 'EIU112', '2016-06-23', 62,200,150); INSERT INTO Trip VALUES('343271', '021', 'JDO682', '2016-12-04', 3, 400,250); INSERT INTO Trip VALUES('167005', '047', 'TPO652', '2016-10-20', 51, 120,80); CREATE TABLE Itinerary ( Tour_No CHAR(3) NOT NULL, Day_No TINYINT NOT NULL, Hotel_Booking_No CHAR(6) NOT NULL, Activities VARCHAR(150), Meals VARCHAR(150), CONSTRAINT Itinerary_pk PRIMARY KEY (Tour_No, Day_No), CONSTRAINT I_Tour_fk FOREIGN KEY (Tour_No) REFERENCES Tour (Tour_No) ); INSERT INTO Itinerary VALUES('055', 001, '000342', 'Guided tour around the CBD', 'Lunch on Lygon Street'); INSERT INTO Itinerary VALUES('047', 001, '000599', 'Wine tasting at Pizzini''s', 'Lunch at Pizzini''s'); CREATE TABLE Trip_Booking ( Trip_Booking_No CHAR(6) NOT NULL, Trip_Id CHAR(6) NOT NULL, Booking_Date DATE, Deposit_Amount DECIMAL(6,2), CONSTRAINT Trip_Booking_pk PRIMARY KEY (Trip_Booking_No), CONSTRAINT TB_Trip_fk FOREIGN KEY (Trip_Id) REFERENCES Trip (Trip_Id) ); INSERT INTO Trip_Booking VALUES('004564', '004572', '2016-08-15', 100); INSERT INTO Trip_Booking VALUES('007214', '167005', '2016-05-27', 500); INSERT INTO Trip_Booking VALUES('008050', '343271', '2016-11-01', 150); CREATE TABLE Customer ( Customer_Id CHAR(6) NOT NULL, First_Name VARCHAR(35) NOT NULL, Middle_Initial CHAR(1), Last_Name VARCHAR(35) NOT NULL, Street_No SMALLINT NOT NULL, Street_Name VARCHAR(50) NOT NULL, Suburb VARCHAR(35) NOT NULL, Postcode INTEGER NOT NULL, Email VARCHAR(150) NOT NULL, Phone VARCHAR(10), Auth VARCHAR(32), CONSTRAINT Customer_pk PRIMARY KEY (Customer_Id) ); INSERT INTO Customer VALUES('031642', 'Freddie', NULL, 'Khan', 500, 'Waverly Road', 'Chadstone', 3555, 'fred.khan@holmesglen.edu.au', NULL,NULL); INSERT INTO Customer VALUES('001484', 'William', 'B', 'Pitt', 200, 'St. Kilda Road', 'St. Kilda', 3147, 'bill.pitt@gmail.com', '0351806451',NULL); CREATE TABLE Customer_Booking ( Trip_Booking_No CHAR(6) NOT NULL, Customer_Id CHAR(6) NOT NULL, Num_Concessions INTEGER NOT NULL, Num_Adults INTEGER NOT NULL, CONSTRAINT Customer_Booking_pk PRIMARY KEY (Trip_Booking_No, Customer_Id), CONSTRAINT CB_Trip_Booking_fk FOREIGN KEY (Trip_Booking_No) REFERENCES Trip_Booking (Trip_Booking_No), CONSTRAINT CB_Customer_fk FOREIGN KEY (Customer_Id) REFERENCES Customer (Customer_Id) ); INSERT INTO Customer_Booking VALUES('004564', '031642',2,2); INSERT INTO Customer_Booking VALUES('007214', '001484',1,0); INSERT INTO Customer_Booking VALUES('008050', '001484',2,0); CREATE TABLE Customer_Review ( Trip_Id CHAR(6) NOT NULL, Customer_Id CHAR(6) NOT NULL, Rating Tinyint NOT NULL CHECK (Rating >= 0 and Rating <= 5), General_Feedback VARCHAR(256), Likes VARCHAR(256), Dislikes VARCHAR(256), CONSTRAINT Customer_Review_pk PRIMARY KEY (Trip_Id, Customer_Id), CONSTRAINT CR_Trip_fk FOREIGN KEY (Trip_Id) REFERENCES Trip (Trip_Id), CONSTRAINT CR_Customer_fk FOREIGN KEY (Customer_Id) REFERENCES Customer (Customer_Id) ); INSERT INTO Customer_Review VALUES('004572', '031642', 5, 'Excellent trip, I will be booking with you guys again next year!', 'The whole trip was very reasonably priced.', 'None!'); INSERT INTO Customer_Review VALUES('167005', '001484', 3, 'It was okay, not as good as Kontiki', 'Staff were nice', 'The food was rubbish'); INSERT INTO Customer_Review VALUES('343271', '001484', 4, 'Better than the last one', 'Staff were nice like last time and the food was better', 'The tour bus was too noisy');
spool c:\temp\db_ws1415.log set feedback off set define off prompt Dropping FACH... drop table FACH cascade constraints; prompt Dropping FACHBEREICH... drop table FACHBEREICH cascade constraints; prompt Dropping STUDIENGANG... drop table STUDIENGANG cascade constraints; prompt Dropping ANGEBOT... drop table ANGEBOT cascade constraints; prompt Dropping KLAUSUR... drop table KLAUSUR cascade constraints; prompt Dropping NOTENSKALA... drop table NOTENSKALA cascade constraints; prompt Dropping studentische_person... drop table studentische_person cascade constraints; prompt Dropping ANMELDUNG... drop table ANMELDUNG cascade constraints; prompt Dropping KLAUS_BEZIE_ANGEBO... drop table KLAUS_BEZIE_ANGEBO cascade constraints; prompt Dropping LEISTUNGSSCHEIN... drop table LEISTUNGSSCHEIN cascade constraints; prompt Dropping EMP... drop table EMP cascade constraints; prompt Dropping DEPT... drop table DEPT cascade constraints; prompt Dropping BONUS... drop table BONUS cascade constraints; prompt Dropping SALGRADE... drop table SALGRADE cascade constraints; prompt Creating FACH... create table FACH ( FACHNR NUMBER(8) not null, BEZEICHNUNG VARCHAR2(50) not null ) ; alter table FACH add primary key (FACHNR); alter table FACH add constraint C_FACHNR_GROESSER_NULL check (fachnr > 0 ); prompt Creating FACHBEREICH... create table FACHBEREICH ( FACHBEREICHNR NUMBER(8) not null, BEZEICHNUNG VARCHAR2(50) not null ) ; alter table FACHBEREICH add primary key (FACHBEREICHNR); alter table FACHBEREICH add constraint C_PK_GROESSER_NULL check (fachbereichnr >0 ); prompt Creating STUDIENGANG... create table STUDIENGANG ( STUDIENGANGNR NUMBER(8) not null, BEZEICHNUNG VARCHAR2(50) not null, FACHBEREICHNR NUMBER(8) not null ) ; alter table STUDIENGANG add primary key (STUDIENGANGNR); alter table STUDIENGANG add constraint FK_STUDIENGANG_FACHBEREICH foreign key (FACHBEREICHNR) references FACHBEREICH (FACHBEREICHNR); alter table STUDIENGANG add constraint C_PK_GOESSER_NULL check (studiengangnr > 0 ); prompt Creating ANGEBOT... create table ANGEBOT ( STUDIENGANGNR NUMBER(8) not null, FACHNR NUMBER(8) not null ) ; alter table ANGEBOT add primary key (STUDIENGANGNR, FACHNR); alter table ANGEBOT add constraint FK_ANGEBOT_FACH foreign key (FACHNR) references FACH (FACHNR); alter table ANGEBOT add constraint FK_ANGEBOT_STGANG foreign key (STUDIENGANGNR) references STUDIENGANG (STUDIENGANGNR); prompt Creating KLAUSUR... create table KLAUSUR ( KLAUSURNR NUMBER(8) not null, DATUM DATE not null, HILFSMITTEL VARCHAR2(2000), DOZENTEN VARCHAR2(200) default '' not null, RAUM VARCHAR2(50) ) ; alter table KLAUSUR add primary key (KLAUSURNR); alter table KLAUSUR add constraint C_KLNR_GROESSER_NULL check (klausurnr > 0 ); prompt Creating NOTENSKALA... create table NOTENSKALA ( NOTEN NUMBER(2,1) not null ) ; alter table NOTENSKALA add constraint PK_NOTENSKALA primary key (NOTEN); alter table NOTENSKALA add constraint C_NOTEN check (noten in (1,1.3,1.7,2,2.3,2.7,3,3.3,3.7,4,5) ); prompt Creating studentische_person... create table studentische_person ( MATRIKELNR NUMBER(8) not null, NAME VARCHAR2(50) not null, STUDIENGANGNR NUMBER(8) not null, UNIX_NAME CHAR(8) ) ; alter table studentische_person add primary key (MATRIKELNR); alter table studentische_person add constraint U_UNIX_NAME unique (UNIX_NAME); alter table studentische_person add constraint FK_STUDENT_STGANG foreign key (STUDIENGANGNR) references STUDIENGANG (STUDIENGANGNR); alter table studentische_person add constraint C_MAT_GROESSER_NULL check (matrikelnr > 0 ); alter table studentische_person add constraint C_UNIX_NAME check (unix_name = upper(unix_name) ); prompt Creating ANMELDUNG... create table ANMELDUNG ( MATRIKELNR NUMBER(8) not null, KLAUSURNR NUMBER(8) not null, NOTE NUMBER(2,1) ) ; alter table ANMELDUNG add primary key (MATRIKELNR, KLAUSURNR); alter table ANMELDUNG add constraint FK_ANMELDUNG_KLAUSUR foreign key (KLAUSURNR) references KLAUSUR (KLAUSURNR); alter table ANMELDUNG add constraint FK_ANMELDUNG_STUDENT foreign key (MATRIKELNR) references studentische_person (MATRIKELNR); alter table ANMELDUNG add constraint FK_NOTEN foreign key (NOTE) references NOTENSKALA (NOTEN); prompt Creating KLAUS_BEZIE_ANGEBO... create table KLAUS_BEZIE_ANGEBO ( KLAUSURNR NUMBER(8) not null, STUDIENGANGNR NUMBER(8) not null, FACHNR NUMBER(8) not null ) ; alter table KLAUS_BEZIE_ANGEBO add primary key (KLAUSURNR, STUDIENGANGNR, FACHNR); alter table KLAUS_BEZIE_ANGEBO add constraint FK_KLAUS_BEZIE_ANGEBO_ANGEBOT foreign key (STUDIENGANGNR, FACHNR) references ANGEBOT (STUDIENGANGNR, FACHNR); alter table KLAUS_BEZIE_ANGEBO add constraint FK_KLAUS_BEZIE_ANGEBO_KLAUSUR foreign key (KLAUSURNR) references KLAUSUR (KLAUSURNR) deferrable initially deferred; prompt Creating LEISTUNGSSCHEIN... create table LEISTUNGSSCHEIN ( MATRIKELNR NUMBER(8) not null, FACHNR NUMBER(8) not null, NOTE NUMBER(2,1), ANZAHL_VERSUCHE NUMBER(1) ) ; alter table LEISTUNGSSCHEIN add primary key (MATRIKELNR, FACHNR); alter table LEISTUNGSSCHEIN add constraint FK_LSCHEIN_FACH foreign key (FACHNR) references FACH (FACHNR); alter table LEISTUNGSSCHEIN add constraint FK_LSCHEIN_STUDENT foreign key (MATRIKELNR) references studentische_person (MATRIKELNR); alter table LEISTUNGSSCHEIN add constraint FK_SCHEIN_ foreign key (NOTE) references NOTENSKALA (NOTEN); alter table LEISTUNGSSCHEIN add constraint C_ANZAHL_VERSUCHE check (((anzahl_versuche in (1,2,3) or anzahl_versuche is null) and note is not null) or (note is null and anzahl_versuche =1) ); prompt Disabling foreign key constraints for STUDIENGANG... alter table STUDIENGANG disable constraint FK_STUDIENGANG_FACHBEREICH; prompt Disabling foreign key constraints for ANGEBOT... alter table ANGEBOT disable constraint FK_ANGEBOT_FACH; alter table ANGEBOT disable constraint FK_ANGEBOT_STGANG; prompt Disabling foreign key constraints for studentische_person... alter table studentische_person disable constraint FK_STUDENT_STGANG; prompt Disabling foreign key constraints for ANMELDUNG... alter table ANMELDUNG disable constraint FK_ANMELDUNG_KLAUSUR; alter table ANMELDUNG disable constraint FK_ANMELDUNG_STUDENT; alter table ANMELDUNG disable constraint FK_NOTEN; prompt Disabling foreign key constraints for KLAUS_BEZIE_ANGEBO... alter table KLAUS_BEZIE_ANGEBO disable constraint FK_KLAUS_BEZIE_ANGEBO_ANGEBOT; alter table KLAUS_BEZIE_ANGEBO disable constraint FK_KLAUS_BEZIE_ANGEBO_KLAUSUR; prompt Disabling foreign key constraints for LEISTUNGSSCHEIN... alter table LEISTUNGSSCHEIN disable constraint FK_LSCHEIN_FACH; alter table LEISTUNGSSCHEIN disable constraint FK_LSCHEIN_STUDENT; alter table LEISTUNGSSCHEIN disable constraint FK_SCHEIN_; prompt Loading FACH... insert into FACH (FACHNR, BEZEICHNUNG) values (1, 'Statistik'); insert into FACH (FACHNR, BEZEICHNUNG) values (2, 'Mathematik'); insert into FACH (FACHNR, BEZEICHNUNG) values (3, 'Grundlagen Datenbanken'); insert into FACH (FACHNR, BEZEICHNUNG) values (4, 'Steuern'); insert into FACH (FACHNR, BEZEICHNUNG) values (5, 'Steuern fuer Fortgeschrittene'); insert into FACH (FACHNR, BEZEICHNUNG) values (6, 'BWL I'); commit; prompt 6 records loaded prompt Loading FACHBEREICH... insert into FACHBEREICH (FACHBEREICHNR, BEZEICHNUNG) values (10, 'Wirtschaft'); insert into FACHBEREICH (FACHBEREICHNR, BEZEICHNUNG) values (6, 'Informatik'); commit; prompt 2 records loaded prompt Loading STUDIENGANG... insert into STUDIENGANG (STUDIENGANGNR, BEZEICHNUNG, FACHBEREICHNR) values (903, 'BSc Wirtschaftsinformatik', 10); insert into STUDIENGANG (STUDIENGANGNR, BEZEICHNUNG, FACHBEREICHNR) values (904, 'BA Betriebswirtschaft', 10); insert into STUDIENGANG (STUDIENGANGNR, BEZEICHNUNG, FACHBEREICHNR) values (916, 'BA International Business', 10); insert into STUDIENGANG (STUDIENGANGNR, BEZEICHNUNG, FACHBEREICHNR) values (933, 'MSc Wirtschaftsinformatik', 10); insert into STUDIENGANG (STUDIENGANGNR, BEZEICHNUNG, FACHBEREICHNR) values (934, 'MA International Business Management', 10); insert into STUDIENGANG (STUDIENGANGNR, BEZEICHNUNG, FACHBEREICHNR) values (943, 'BSc Informatik', 6); insert into STUDIENGANG (STUDIENGANGNR, BEZEICHNUNG, FACHBEREICHNR) values (944, 'MSc Informatik', 6); commit; prompt 7 records loaded prompt Loading ANGEBOT... insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (903, 1); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (903, 2); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (903, 4); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (903, 6); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (904, 1); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (904, 2); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (904, 4); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (904, 5); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (904, 6); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (916, 1); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (916, 2); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (916, 4); insert into ANGEBOT (STUDIENGANGNR, FACHNR) values (916, 6); commit; prompt 13 records loaded prompt Loading KLAUSUR... insert into KLAUSUR (KLAUSURNR, DATUM, HILFSMITTEL, DOZENTEN, RAUM) values (1, to_date('17-01-2015 09:00:00', 'dd-mm-yyyy hh24:mi:ss'), 'Alle papiergebundenen Unterlagen', 'Fuchs, Hase', 'Aula'); insert into KLAUSUR (KLAUSURNR, DATUM, HILFSMITTEL, DOZENTEN, RAUM) values (2, to_date('18-01-2015 10:0:00', 'dd-mm-yyyy hh24:mi:ss'), 'Keine ', 'Maus', 'HS3, Aula'); insert into KLAUSUR (KLAUSURNR, DATUM, HILFSMITTEL, DOZENTEN, RAUM) values (3, to_date('19-01-2015 14:30:00', 'dd-mm-yyyy hh24:mi:ss'), 'Taschenrechner, Alle papiergebundenen Unterlagen', 'Katze', null); insert into KLAUSUR (KLAUSURNR, DATUM, HILFSMITTEL, DOZENTEN, RAUM) values (4, to_date('20-01-2015 11:15:00', 'dd-mm-yyyy hh24:mi:ss'), 'Keine', 'Fisch', 'HS3'); insert into KLAUSUR (KLAUSURNR, DATUM, HILFSMITTEL, DOZENTEN, RAUM) values (5, to_date('21-01-2015 12:00:00', 'dd-mm-yyyy hh24:mi:ss'), 'Sparsam kommentierte Gesetzestexte', 'Pferd, Kuh', 'Aula'); commit; prompt 5 records loaded prompt Loading NOTENSKALA... insert into NOTENSKALA (NOTEN) values (1); insert into NOTENSKALA (NOTEN) values (1.3); insert into NOTENSKALA (NOTEN) values (1.7); insert into NOTENSKALA (NOTEN) values (2); insert into NOTENSKALA (NOTEN) values (2.3); insert into NOTENSKALA (NOTEN) values (2.7); insert into NOTENSKALA (NOTEN) values (3); insert into NOTENSKALA (NOTEN) values (3.3); insert into NOTENSKALA (NOTEN) values (3.7); insert into NOTENSKALA (NOTEN) values (4); insert into NOTENSKALA (NOTEN) values (5); commit; prompt 11 records loaded prompt Loading studentische_person... insert into studentische_person (MATRIKELNR, NAME, STUDIENGANGNR, UNIX_NAME) values (123456, 'Hugo McKinnock', 903, 'MCKINNOH'); insert into studentische_person (MATRIKELNR, NAME, STUDIENGANGNR, UNIX_NAME) values (234567, 'Nicole Mueller', 916, 'MUELLERN'); insert into studentische_person (MATRIKELNR, NAME, STUDIENGANGNR, UNIX_NAME) values (345678, 'Katja Strauch', 904, 'STRAUCHK'); insert into studentische_person (MATRIKELNR, NAME, STUDIENGANGNR, UNIX_NAME) values (567890, 'Jana Mai', 904, 'MAIJANA '); commit; prompt 4 records loaded prompt Loading ANMELDUNG... insert into ANMELDUNG (MATRIKELNR, KLAUSURNR, NOTE) values (123456, 4, null); insert into ANMELDUNG (MATRIKELNR, KLAUSURNR, NOTE) values (123456, 1, 2.3); insert into ANMELDUNG (MATRIKELNR, KLAUSURNR, NOTE) values (123456, 2, 2); insert into ANMELDUNG (MATRIKELNR, KLAUSURNR, NOTE) values (123456, 3, 2.7); insert into ANMELDUNG (MATRIKELNR, KLAUSURNR, NOTE) values (234567, 3, 2.7); insert into ANMELDUNG (MATRIKELNR, KLAUSURNR, NOTE) values (345678, 3, 2.7); commit; prompt 6 records loaded prompt Loading KLAUS_BEZIE_ANGEBO... insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (1, 903, 1); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (1, 904, 1); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (1, 916, 1); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (2, 904, 4); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (2, 916, 4); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (3, 904, 5); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (4, 903, 2); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (5, 903, 6); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (5, 904, 6); insert into KLAUS_BEZIE_ANGEBO (KLAUSURNR, STUDIENGANGNR, FACHNR) values (5, 916, 6); commit; prompt 10 records loaded prompt Loading LEISTUNGSSCHEIN... insert into LEISTUNGSSCHEIN (MATRIKELNR, FACHNR, NOTE, ANZAHL_VERSUCHE) values (234567, 4, null, 1); insert into LEISTUNGSSCHEIN (MATRIKELNR, FACHNR, NOTE, ANZAHL_VERSUCHE) values (123456, 4, null, 1); insert into LEISTUNGSSCHEIN (MATRIKELNR, FACHNR, NOTE, ANZAHL_VERSUCHE) values (123456, 3, null, null); insert into LEISTUNGSSCHEIN (MATRIKELNR, FACHNR, NOTE, ANZAHL_VERSUCHE) values (123456, 5, 2.7, null); insert into LEISTUNGSSCHEIN (MATRIKELNR, FACHNR, NOTE, ANZAHL_VERSUCHE) values (234567, 5, 2.7, 2); insert into LEISTUNGSSCHEIN (MATRIKELNR, FACHNR, NOTE, ANZAHL_VERSUCHE) values (345678, 5, 1.7, 1); insert into LEISTUNGSSCHEIN (MATRIKELNR, FACHNR, NOTE, ANZAHL_VERSUCHE) values (123456, 1, 4, 1); commit; prompt 7 records loaded prompt Enabling foreign key constraints for STUDIENGANG... alter table STUDIENGANG enable constraint FK_STUDIENGANG_FACHBEREICH; prompt Enabling foreign key constraints for ANGEBOT... alter table ANGEBOT enable constraint FK_ANGEBOT_FACH; alter table ANGEBOT enable constraint FK_ANGEBOT_STGANG; prompt Enabling foreign key constraints for studentische_person... alter table studentische_person enable constraint FK_STUDENT_STGANG; prompt Enabling foreign key constraints for ANMELDUNG... alter table ANMELDUNG enable constraint FK_ANMELDUNG_KLAUSUR; alter table ANMELDUNG enable constraint FK_ANMELDUNG_STUDENT; alter table ANMELDUNG enable constraint FK_NOTEN; prompt Enabling foreign key constraints for KLAUS_BEZIE_ANGEBO... alter table KLAUS_BEZIE_ANGEBO enable constraint FK_KLAUS_BEZIE_ANGEBO_ANGEBOT; alter table KLAUS_BEZIE_ANGEBO enable constraint FK_KLAUS_BEZIE_ANGEBO_KLAUSUR; prompt Enabling foreign key constraints for LEISTUNGSSCHEIN... alter table LEISTUNGSSCHEIN enable constraint FK_LSCHEIN_FACH; alter table LEISTUNGSSCHEIN enable constraint FK_LSCHEIN_STUDENT; alter table LEISTUNGSSCHEIN enable constraint FK_SCHEIN_; prompt prompt Creating view KLAUSURANMELDUNG prompt ============================== prompt create or replace view klausuranmeldung as select klausurnr,datum,hilfsmittel,dozenten,raum -- select klausurnr,datum,substr(hilfsmittel,1,40) from klausur where -- datum - (sysdate + 14) >= 0 and klausurnr in (select klausurnr from klaus_bezie_angebo where (fachnr,studiengangnr) in ( select fachnr,studiengangnr from angebot where studiengangnr = (select studiengangnr from studentische_person where Unix_name=user ) and fachnr in (select fachnr from fach where fachnr not in (select fachnr from leistungsschein where matrikelnr= (select matrikelnr from studentische_person where unix_name =user) and (note is not null or anzahl_versuche =3) ) ) ) ) / prompt prompt Creating view NOTEN prompt =================== prompt create or replace view noten as select klausurnr,note from anmeldung where matrikelnr = (select matrikelnr from studentische_person where unix_name=user) and note is not null / prompt prompt Creating function ANMELDUNG_ZULAESSIG prompt ===================================== prompt create or replace function anmeldung_zulaessig(matrikelnr_in IN number,klausurnr_in IN number) return boolean as v_ergebnis char(2):='no'; begin select 'ok' into v_ergebnis from dual where exists ( select klausurnr from klausur where klausurnr= klausurnr_in and datum - (sysdate + 14) >= 0 and klausurnr in (select klausurnr from klaus_bezie_angebo where (fachnr,studiengangnr) in ( select fachnr,studiengangnr from angebot where studiengangnr = (select studiengangnr from studentische_person where MATRIKELNR = matrikelnr_in) and fachnr in (select fachnr from fach where fachnr not in (select fachnr from leistungsschein where matrikelnr=matrikelnr_in and ((note is not null and note <= 4) or anzahl_versuche=3) ) ) ) ) ); if v_ergebnis='ok' then return TRUE; else return false; end if; exception when others then raise_application_error(-20030,'Fehler in anmeldung_zulaessig function!'||substr(SQLERRM,1,80)); end; / prompt prompt Creating procedure DROP_ANMELD_KLAUSUR prompt ====================================== prompt create or replace procedure drop_anmeld_klausur(klausur_nr_in in number) as v_matrikelnr studentische_person.matrikelnr%type; v_klausurnr klausuranmeldung.klausurnr%type; begin begin select matrikelnr into v_matrikelnr from studentische_person where unix_name=user for update; exception when no_data_found then raise_application_error(-20008,'Es gibt keinen Studierenden mit dieser Kennung!'); end; begin select klausurnr into v_klausurnr from klausuranmeldung where klausurnr=klausur_nr_in for update; exception when no_data_found then raise_application_error(-20009,'Es liegt keine Anmeldung vor fur den Studierenden zu der Klausur!'); end; delete from anmeldung where matrikelnr=v_matrikelnr and klausurNr=klausur_nr_in ; exception when others then raise_application_error(-20010,'proc drop_anmeld_klausur: '|| substr(SQLERRM,1,80)); end; / prompt prompt Creating procedure GET_KLAUSUR_ANGEMELDET prompt ========================================= prompt create or replace procedure get_klausur_angemeldet(in_klausur_nr in number, out_angemeldet out number) as v_matrikelnr studentische_person.matrikelnr%type; v_klausurnr anmeldung.klausurnr%type; begin begin select matrikelnr into v_matrikelnr from studentische_person where unix_name=user; exception when no_data_found then raise_application_error(-20008,'Es gibt keinen Studierenden mit dieser Kennung!'); end; begin select klausurnr into v_klausurnr from anmeldung where matrikelnr=v_matrikelnr and klausurnr=in_klausur_nr; out_angemeldet:=1; exception when no_data_found then out_angemeldet:=0; end; exception when others then raise_application_error(-20010,'proc get_klausur_angemeldet: '|| substr(SQLERRM,1,80)); end; / prompt prompt Creating procedure GET_KLAUSUR_FACH_INFO prompt ======================================== prompt CREATE OR REPLACE PROCEDURE Get_Klausur_Fach_Info (in_klausurnr IN NUMBER, out_fachbezeichnung OUT VARCHAR2) AS v_fachnr FACH.fachnr%TYPE; BEGIN begin SELECT DISTINCT fachnr INTO v_fachnr FROM KLAUS_BEZIE_ANGEBO WHERE klausurnr=in_klausurnr; exception when no_data_found then raise_application_error(-20011,'Es gibt keinen Eintrag in KLAUS_BEZIE_ANGEBO zu dieser Klausur!'); end; begin SELECT bezeichnung INTO out_fachbezeichnung FROM FACH WHERE fachnr=v_fachnr; exception when no_data_found then raise_application_error(-20011,'Es gibt keinen Eintrag in KLAUS_BEZIE_ANGEBO zu dieser Klausur!'); end; EXCEPTION WHEN OTHERS THEN raise_application_error(-20010,'proc get_klausur_info: '|| substr(SQLERRM,1,80)); END; / prompt prompt Creating procedure GET_STUDENTEN_INFO prompt ===================================== prompt create or replace procedure get_studenten_info (unix_id in varchar2, out_name out varchar2, -- out_studienabschnitt out varchar2, out_studiengang out varchar2, out_fachbereich out varchar2, out_matrikelnr out varchar2 ) as v_studiengangnr studiengang.studiengangnr%type; v_fachbereichsnr fachbereich.fachbereichnr%type; begin begin select name,studiengangnr,matrikelnr into out_name, v_studiengangnr ,out_matrikelnr from studentische_person where unix_name=unix_id; exception when no_data_found then raise_application_error(-20011,'Es gibt keinen Studierenden mit dieser Kennung!'); end; begin select bezeichnung,fachbereichnr into out_studiengang,v_fachbereichsnr from studiengang where studiengangnr=v_studiengangnr; EXCEPTION WHEN no_data_found THEN raise_application_error(-20015,'Den Studiengang '||v_studiengangnr||' gibt es nicht!'); end; begin select bezeichnung into out_fachbereich from fachbereich where fachbereichnr=v_fachbereichsnr; EXCEPTION WHEN no_data_found THEN raise_application_error(-20016,'Den Fachbereich '||v_fachbereichsnr||' gibt es nicht!'); end; EXCEPTION WHEN OTHERS THEN raise_application_error(-20010,'proc get_studenten_info: '|| substr(SQLERRM,1,80)); end; / prompt prompt Creating procedure PUT_ANMELD_KLAUSUR prompt ===================================== prompt create or replace procedure put_anmeld_klausur(klausur_nr_in in number) as v_matrikelnr studentische_person.matrikelnr%type; v_klausurnr klausuranmeldung.klausurnr%type; begin begin select matrikelnr into v_matrikelnr from studentische_person where unix_name=user for update; exception when no_data_found then raise_application_error(-20003,'Es gibt keinen Studierenden mit dieser Kennung!'); end; begin select klausurnr into v_klausurnr from klausuranmeldung where klausurnr=klausur_nr_in for update; exception when no_data_found then raise_application_error(-20003,'Es gibt keine Klausuranmeldung fuer diesen Studenten!'); end; insert into anmeldung(matrikelnr,klausurnr,note) values(v_matrikelnr, klausur_nr_in,null); exception when others then raise_application_error(-20031,'proc put_anmeld_klausur: '|| substr(SQLERRM,1,80)); end; / prompt prompt Creating trigger ANMELDUNG_D prompt ============================ prompt CREATE OR REPLACE TRIGGER anmeldung_d AFTER DELETE ON ANMELDUNG FOR EACH ROW DECLARE v_matrikelnr studentische_person.matrikelnr%TYPE; v_fachnr FACH.fachnr%TYPE; v_anzahl_versuche LEISTUNGSSCHEIN.anzahl_versuche%TYPE :=-1; v_err_msg VARCHAR2(200); v_klausurdatum DATE; BEGIN SELECT DATUM INTO v_klausurdatum FROM KLAUSUR WHERE KLAUSURNR = :OLD.KLAUSURNR for update; IF v_klausurdatum < SYSDATE + 14 THEN RAISE_APPLICATION_ERROR(-20050,'Abmeldung jetzt nicht mehr moeglich!'); END IF; BEGIN SELECT DISTINCT fachnr INTO v_fachnr FROM KLAUS_BEZIE_ANGEBO WHERE klausurnr=:OLD.klausurnr; EXCEPTION WHEN OTHERS THEN v_err_msg:='Trigger:ANMELDUNG_D: '||SUBSTR(SQLERRM,1,80); RAISE_APPLICATION_ERROR(-20020,v_err_msg); END; begin SELECT anzahl_versuche INTO v_anzahl_versuche FROM LEISTUNGSSCHEIN WHERE matrikelnr=:OLD.matrikelnr AND fachnr=v_fachnr; EXCEPTION WHEN no_data_found THEN RAISE_APPLICATION_ERROR(-20020,'Kein Leistungsschein gefunden zu '||:OLD.matrikelnr||','||v_fachnr); end; IF v_anzahl_versuche = 1 THEN DELETE FROM LEISTUNGSSCHEIN WHERE matrikelnr=:OLD.matrikelnr AND fachnr=v_fachnr; ELSE UPDATE LEISTUNGSSCHEIN SET anzahl_versuche = anzahl_versuche -1 WHERE matrikelnr=:OLD.matrikelnr AND fachnr=v_fachnr; END IF; EXCEPTION WHEN OTHERS THEN v_err_msg:='Trigger:ANMELDUNG_D: '||SUBSTR(SQLERRM,1,80); RAISE_APPLICATION_ERROR(-20020,v_err_msg); END; / prompt prompt Creating trigger ANMELDUNG_I prompt ============================ prompt create or replace trigger anmeldung_i before insert on anmeldung for each row DECLARE V_FACHNR FACH.FACHNR%TYPE; V_ANZAHL_VERSUCHE LEISTUNGSSCHEIN.ANZAHL_VERSUCHE%TYPE := -1; V_ERR_MSG VARCHAR2(4000); BEGIN IF NOT ANMELDUNG_ZULAESSIG(:NEW.MATRIKELNR, :NEW.KLAUSURNR) THEN RAISE_APPLICATION_ERROR(-20040, 'Anmeldung nicht kompatibel fuer Studierenden!'); END IF; BEGIN SELECT DISTINCT FACHNR INTO V_FACHNR FROM KLAUS_BEZIE_ANGEBO WHERE KLAUSURNR = :NEW.KLAUSURNR; EXCEPTION WHEN NO_DATA_FOUND THEN RAISE_APPLICATION_ERROR(-20010, 'Kein Fach zur Klausur!'); END; SELECT ANZAHL_VERSUCHE INTO V_ANZAHL_VERSUCHE FROM LEISTUNGSSCHEIN WHERE MATRIKELNR = :NEW.MATRIKELNR AND FACHNR = V_FACHNR FOR UPDATE; UPDATE LEISTUNGSSCHEIN SET ANZAHL_VERSUCHE = ANZAHL_VERSUCHE + 1 WHERE MATRIKELNR = :NEW.MATRIKELNR AND FACHNR = V_FACHNR; EXCEPTION WHEN NO_DATA_FOUND THEN INSERT INTO LEISTUNGSSCHEIN VALUES (:NEW.MATRIKELNR, V_FACHNR, NULL, 1); WHEN OTHERS THEN V_ERR_MSG := 'Trigger:ANMELDUNG_I: ' || SUBSTR(SQLERRM, 1, 80); RAISE_APPLICATION_ERROR(-20020, V_ERR_MSG); END; / prompt prompt Creating trigger KLAUS_BEZIE_ANGEBO_IU prompt ====================================== prompt create or replace trigger klaus_bezie_angebo_iu before insert or update on klaus_bezie_angebo for each row declare testfeld char(1) :=''; begin select 'x' into testfeld from dual where not exists (select 'x' from klaus_bezie_angebo where klausurnr=:new.klausurnr and fachnr!=:new.fachnr); exception when others then raise_application_error(-20001,'Klausur darf sich nur auf ein Fach beziehen !'); end; / prompt prompt Creating trigger KLAUSUR_I prompt ========================== prompt CREATE OR REPLACE TRIGGER klausur_i BEFORE INSERT OR UPDATE OF klausurnr ON KLAUSUR FOR EACH ROW DECLARE v_klausurnr KLAUSUR.KLAUSURNR%TYPE; v_err_msg VARCHAR2(200); BEGIN SELECT DISTINCT klausurnr INTO v_klausurnr FROM KLAUS_BEZIE_ANGEBO WHERE klausurnr=:NEW.klausurnr; EXCEPTION WHEN NO_DATA_FOUND THEN RAISE_APPLICATION_ERROR(-20100,'Klausur ist noch keinem Angebot zugeordnet'); WHEN OTHERS THEN v_err_msg:='Trigger:ANMELDUNG_I: '||SUBSTR(SQLERRM,1,80); RAISE_APPLICATION_ERROR(-20020,v_err_msg); END; / prompt prompt Creating table DEPT prompt =================== prompt CREATE TABLE DEPT (DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY, DNAME VARCHAR2(14) , LOC VARCHAR2(13) ) ; prompt prompt Creating table EMP prompt ================== prompt CREATE TABLE EMP (EMPNO NUMBER(4) CONSTRAINT PK_EMP PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2) CONSTRAINT FK_DEPTNO REFERENCES DEPT); prompt prompt loading DEPT... INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK'); INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS'); INSERT INTO DEPT VALUES (30,'SALES','CHICAGO'); INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON'); COMMIT; prompt 4 records loaded prompt loading EMP.... INSERT INTO EMP VALUES (7369,'SMITH','CLERK',7902,to_date('17-12-1980','dd-mm-yyyy'),800,NULL,20); INSERT INTO EMP VALUES (7499,'ALLEN','SALESMAN',7698,to_date('20-2-1981','dd-mm-yyyy'),1600,300,30); INSERT INTO EMP VALUES (7521,'WARD','SALESMAN',7698,to_date('22-2-1981','dd-mm-yyyy'),1250,500,30); INSERT INTO EMP VALUES (7566,'JONES','MANAGER',7839,to_date('2-4-1981','dd-mm-yyyy'),2975,NULL,20); INSERT INTO EMP VALUES (7654,'MARTIN','SALESMAN',7698,to_date('28-9-1981','dd-mm-yyyy'),1250,1400,30); INSERT INTO EMP VALUES (7698,'BLAKE','MANAGER',7839,to_date('1-5-1981','dd-mm-yyyy'),2850,NULL,30); INSERT INTO EMP VALUES (7782,'CLARK','MANAGER',7839,to_date('9-6-1981','dd-mm-yyyy'),2450,NULL,10); INSERT INTO EMP VALUES (7788,'SCOTT','ANALYST',7566,to_date('13-7-1987','dd-mm-yyyy'),3000,NULL,20); INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL,to_date('17-11-1981','dd-mm-yyyy'),5000,NULL,10); INSERT INTO EMP VALUES (7844,'TURNER','SALESMAN',7698,to_date('8-9-1981','dd-mm-yyyy'),1500,0,30); INSERT INTO EMP VALUES (7876,'ADAMS','CLERK',7788,to_date('13-7-87', 'dd-mm-yyyy'),1100,NULL,20); INSERT INTO EMP VALUES (7900,'JAMES','CLERK',7698,to_date('3-12-1981','dd-mm-yyyy'),950,NULL,30); INSERT INTO EMP VALUES (7902,'FORD','ANALYST',7566,to_date('3-12-1981','dd-mm-yyyy'),3000,NULL,20); INSERT INTO EMP VALUES (7934,'MILLER','CLERK',7782,to_date('23-1-1982','dd-mm-yyyy'),1300,NULL,10); COMMIT; prompt 14 records loaded prompt prompt Creating table BONUS prompt ==================== prompt CREATE TABLE BONUS ( ENAME VARCHAR2(10) , JOB VARCHAR2(9) , SAL NUMBER, COMM NUMBER ) ; prompt prompt Creating table SALGRADE prompt ======================= prompt CREATE TABLE SALGRADE ( GRADE NUMBER, LOSAL NUMBER, HISAL NUMBER ); prompt loading SALGRADE... INSERT INTO SALGRADE VALUES (1,700,1200); INSERT INTO SALGRADE VALUES (2,1201,1400); INSERT INTO SALGRADE VALUES (3,1401,2000); INSERT INTO SALGRADE VALUES (4,2001,3000); INSERT INTO SALGRADE VALUES (5,3001,9999); COMMIT; prompt 5 records loaded set feedback on set define on prompt Done. spool off
USE pyrates; SET AUTOCOMMIT = 0; START TRANSACTION; DELETE FROM ships; ROLLBACK; /*COMMIT;*/ SET AUTOCOMMIT = 1;
DROP TABLE IF EXISTS test; CREATE EXTERNAL TABLE test(lat float, lon float, depth float, time String, project String, vessel String, line String, profile String, beam int, accuracy float, status String) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION 's3a://test-bathymetry-point-data-small/' tblproperties ("skip.header.line.count"="1");
-- phpMyAdmin SQL Dump -- version 4.6.6deb5 -- https://www.phpmyadmin.net/ -- -- Servidor: localhost:3306 -- Tiempo de generación: 14-10-2020 a las 20:50:57 -- Versión del servidor: 5.7.31-0ubuntu0.18.04.1 -- Versión de PHP: 7.3.22-1+ubuntu18.04.1+deb.sury.org+1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `bd_mini_proyecto` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblAdministrador` -- CREATE TABLE `TblAdministrador` ( `AdmIdentificacion` int(11) NOT NULL, `AdmContrasenia` varchar(200) NOT NULL, `AdmNombre1` varchar(50) NOT NULL, `AdmNombre2` varchar(50) DEFAULT NULL, `AdmApellido1` varchar(50) NOT NULL, `AdmApellido2` varchar(50) DEFAULT NULL, `AdmCelular` varchar(50) DEFAULT NULL, `AdmCorreo` varchar(50) DEFAULT NULL, `TblTipoIdenticacion_TipId` int(11) NOT NULL, `TblEstado_EstId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `TblAdministrador` -- INSERT INTO `TblAdministrador` (`AdmIdentificacion`, `AdmContrasenia`, `AdmNombre1`, `AdmNombre2`, `AdmApellido1`, `AdmApellido2`, `AdmCelular`, `AdmCorreo`, `TblTipoIdenticacion_TipId`, `TblEstado_EstId`) VALUES (1005934460, '12345', 'Julio', NULL, 'Ruiz', NULL, '3104123331', 'jcruiz064@misena.edu.co', 1, 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblCliente` -- CREATE TABLE `TblCliente` ( `CliIdentificacion` int(11) NOT NULL, `CliContrasenia` varchar(200) NOT NULL, `CliNombre1` varchar(50) NOT NULL, `CliNombre2` varchar(50) DEFAULT NULL, `CliApellido1` varchar(50) NOT NULL, `CliApellido2` varchar(50) DEFAULT NULL, `CliCelular` varchar(50) DEFAULT NULL, `CliCorreo` varchar(50) DEFAULT NULL, `TblTipoIdenticacion_TipId` int(11) NOT NULL, `TblEstado_EstId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblEstado` -- CREATE TABLE `TblEstado` ( `EstId` int(11) NOT NULL, `EstEstado` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `TblEstado` -- INSERT INTO `TblEstado` (`EstId`, `EstEstado`) VALUES (1, 'activo'), (2, 'inactivo'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblMetodoPago` -- CREATE TABLE `TblMetodoPago` ( `MetId` int(11) NOT NULL, `MetDescripcion` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `TblMetodoPago` -- INSERT INTO `TblMetodoPago` (`MetId`, `MetDescripcion`) VALUES (1, 'efectivo'), (2, 'tarjeta debito'), (3, 'tarjeta credito'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblPedido` -- CREATE TABLE `TblPedido` ( `PedId` int(11) NOT NULL, `PedFecha` date NOT NULL, `TblCliente_CliIdenficacion` int(11) NOT NULL, `TblMetodoPago_MetId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblProducto` -- CREATE TABLE `TblProducto` ( `ProRef` int(11) NOT NULL, `ProNombre` varchar(50) NOT NULL, `ProPrecio` decimal(10,0) NOT NULL, `ProStock` int(11) NOT NULL, `ProFechaVencimiento` date NOT NULL, `TblTipoProducto_TipId` int(11) NOT NULL, `TblEstado_EstId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `TblProducto` -- INSERT INTO `TblProducto` (`ProRef`, `ProNombre`, `ProPrecio`, `ProStock`, `ProFechaVencimiento`, `TblTipoProducto_TipId`, `TblEstado_EstId`) VALUES (1, 'El burgues', '2300', 12, '2020-09-08', 10, 1), (2, 'El cash', '2345', 20, '2020-09-18', 25, 1), (3, 'Kione el de la money', '2300', 12, '2020-09-08', 10, 1), (4, 'Papel de baño', '2345', 20, '2020-09-18', 25, 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblProductoPedido` -- CREATE TABLE `TblProductoPedido` ( `ProPedId` int(11) NOT NULL, `TblProducto_ProRef` int(11) NOT NULL, `TblPedido_PedId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblTipoIdentificacion` -- CREATE TABLE `TblTipoIdentificacion` ( `TipId` int(11) NOT NULL, `TipNombre` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `TblTipoIdentificacion` -- INSERT INTO `TblTipoIdentificacion` (`TipId`, `TipNombre`) VALUES (1, 'cedula'), (2, 'cedula extrangeria'), (3, 'NIT'); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblTipoProducto` -- CREATE TABLE `TblTipoProducto` ( `TipProId` int(11) NOT NULL, `TipProNombre` varchar(50) NOT NULL, `TipProIva` decimal(10,0) NOT NULL, `TblEstado_EstId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `TblTipoProducto` -- INSERT INTO `TblTipoProducto` (`TipProId`, `TipProNombre`, `TipProIva`, `TblEstado_EstId`) VALUES (1, 'Papeleria', '12', 2), (5, 'jhjhj', '12', 2), (6, 'cateogria 2', '19', 1), (7, 'jkjkjkjkhjhhj', '34', 2), (8, 'jjj', '8', 2), (9, 'klkjjjjjjlklkl', '12', 2), (10, 'jkjkjk', '12', 2), (11, 'jkhjk', '3', 2), (12, 'hjhjjjjjhj', '23', 2), (19, 'p', '99', 2), (20, '8', '13', 2), (21, 'klkll', '0', 2), (22, 'kjkjkjk', '20', 2), (23, 'hjjhjh', '2', 2), (24, 'hghhggh', '1', 2), (25, 'jhjhjhj', '3', 2), (26, 'asfjj', '16', 2), (27, 'pol', '1', 2), (28, 'hjjhjj', '16', 2), (29, 'Epa', '8', 2), (30, 'Farmacia', '3', 2), (31, 'lkkl', '2', 2), (32, 'ghgh', '1', 2), (33, 'hghg', '1', 2), (44, 'Farmacias', '3', 1), (45, 'bbv', '5', 2), (48, 'hghgghhg', '1', 2), (51, 'hjghghgh', '4', 1), (52, 'ghghgh', '1', 2), (53, 'categoria-3', '20', 1), (54, 'jkfddfjfjk', '3', 1), (55, 'klklklkl', '1', 1), (56, 'periodico', '1', 1), (57, 'jhhjhjhj', '2', 1), (58, 'kdfjkdfjk', '1', 1), (61, 'hjhhh', '3', 1), (63, 'hkjkk', '6', 1), (67, 'jjjjjjjj', '2', 1), (70, 'llll', '2', 1), (71, 'poooo', '2', 1), (72, 'jjjkk', '1', 1), (76, 'yuuuy', '3', 1), (77, 'kk', '1', 1), (78, 'jkljkljkl', '3', 1), (79, 'kjkjjkkj', '2', 1), (80, 'jhjhjh', '3', 1), (81, 'hjjj', '3', 1), (83, 'jjjjjjjjjjj', '2', 1), (85, 'hhjj', '1', 1), (86, 'jkljklkljkljkl', '1', 1), (89, 'jkjk', '1', 1), (91, 'ghghhg', '2', 1), (95, 'jhj', '4', 1), (96, 'jkkjjkjk', '2', 1); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `TblVendedor` -- CREATE TABLE `TblVendedor` ( `VenIdentificacion` int(11) NOT NULL, `VenContrasenia` int(200) NOT NULL, `VenNombre1` varchar(50) NOT NULL, `VenNombre2` varchar(50) DEFAULT NULL, `VenApellido1` varchar(50) NOT NULL, `VenApellido2` varchar(50) DEFAULT NULL, `VenCelular` varchar(50) DEFAULT NULL, `VenCorreo` varchar(50) DEFAULT NULL, `TblTipoIdenticacion_TIpId` int(11) NOT NULL, `TblEstado_EstId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `TblAdministrador` -- ALTER TABLE `TblAdministrador` ADD PRIMARY KEY (`AdmIdentificacion`), ADD KEY `TblEstado_EstId` (`TblEstado_EstId`), ADD KEY `TblTipoIdenticacion_TipId` (`TblTipoIdenticacion_TipId`); -- -- Indices de la tabla `TblCliente` -- ALTER TABLE `TblCliente` ADD PRIMARY KEY (`CliIdentificacion`), ADD KEY `TblEstado_EstId` (`TblEstado_EstId`), ADD KEY `TblTipoIdenticacion_TipId` (`TblTipoIdenticacion_TipId`); -- -- Indices de la tabla `TblEstado` -- ALTER TABLE `TblEstado` ADD PRIMARY KEY (`EstId`); -- -- Indices de la tabla `TblMetodoPago` -- ALTER TABLE `TblMetodoPago` ADD PRIMARY KEY (`MetId`); -- -- Indices de la tabla `TblPedido` -- ALTER TABLE `TblPedido` ADD PRIMARY KEY (`PedId`), ADD KEY `TblMetodoPago_MetId` (`TblMetodoPago_MetId`); -- -- Indices de la tabla `TblProducto` -- ALTER TABLE `TblProducto` ADD PRIMARY KEY (`ProRef`), ADD UNIQUE KEY `ProNombre` (`ProNombre`), ADD KEY `TblTipoProducto_TipId` (`TblTipoProducto_TipId`), ADD KEY `TblEstado_EstId` (`TblEstado_EstId`); -- -- Indices de la tabla `TblProductoPedido` -- ALTER TABLE `TblProductoPedido` ADD PRIMARY KEY (`ProPedId`), ADD KEY `TblPedido_PedId` (`TblPedido_PedId`), ADD KEY `TblProducto_ProRef` (`TblProducto_ProRef`); -- -- Indices de la tabla `TblTipoIdentificacion` -- ALTER TABLE `TblTipoIdentificacion` ADD PRIMARY KEY (`TipId`); -- -- Indices de la tabla `TblTipoProducto` -- ALTER TABLE `TblTipoProducto` ADD PRIMARY KEY (`TipProId`), ADD UNIQUE KEY `TipProId` (`TipProId`), ADD UNIQUE KEY `TipProId_2` (`TipProId`), ADD UNIQUE KEY `TipProNombre` (`TipProNombre`), ADD KEY `TblEstado_EstId` (`TblEstado_EstId`); -- -- Indices de la tabla `TblVendedor` -- ALTER TABLE `TblVendedor` ADD PRIMARY KEY (`VenIdentificacion`), ADD KEY `TblEstado_EstId` (`TblEstado_EstId`), ADD KEY `TblTipoIdenticacion_TIpId` (`TblTipoIdenticacion_TIpId`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `TblAdministrador` -- ALTER TABLE `TblAdministrador` MODIFY `AdmIdentificacion` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1005934461; -- -- AUTO_INCREMENT de la tabla `TblCliente` -- ALTER TABLE `TblCliente` MODIFY `CliIdentificacion` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `TblEstado` -- ALTER TABLE `TblEstado` MODIFY `EstId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT de la tabla `TblMetodoPago` -- ALTER TABLE `TblMetodoPago` MODIFY `MetId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `TblPedido` -- ALTER TABLE `TblPedido` MODIFY `PedId` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `TblProducto` -- ALTER TABLE `TblProducto` MODIFY `ProRef` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT de la tabla `TblProductoPedido` -- ALTER TABLE `TblProductoPedido` MODIFY `ProPedId` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT de la tabla `TblTipoIdentificacion` -- ALTER TABLE `TblTipoIdentificacion` MODIFY `TipId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT de la tabla `TblTipoProducto` -- ALTER TABLE `TblTipoProducto` MODIFY `TipProId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=97; -- -- AUTO_INCREMENT de la tabla `TblVendedor` -- ALTER TABLE `TblVendedor` MODIFY `VenIdentificacion` int(11) NOT NULL AUTO_INCREMENT; -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `TblAdministrador` -- ALTER TABLE `TblAdministrador` ADD CONSTRAINT `TblAdministrador_ibfk_1` FOREIGN KEY (`TblEstado_EstId`) REFERENCES `TblEstado` (`EstId`), ADD CONSTRAINT `TblAdministrador_ibfk_2` FOREIGN KEY (`TblTipoIdenticacion_TipId`) REFERENCES `TblTipoIdentificacion` (`TipId`); -- -- Filtros para la tabla `TblCliente` -- ALTER TABLE `TblCliente` ADD CONSTRAINT `TblCliente_ibfk_1` FOREIGN KEY (`TblEstado_EstId`) REFERENCES `TblEstado` (`EstId`), ADD CONSTRAINT `TblCliente_ibfk_2` FOREIGN KEY (`TblTipoIdenticacion_TipId`) REFERENCES `TblTipoIdentificacion` (`TipId`); -- -- Filtros para la tabla `TblPedido` -- ALTER TABLE `TblPedido` ADD CONSTRAINT `TblPedido_ibfk_1` FOREIGN KEY (`TblMetodoPago_MetId`) REFERENCES `TblMetodoPago` (`MetId`); -- -- Filtros para la tabla `TblProducto` -- ALTER TABLE `TblProducto` ADD CONSTRAINT `TblProducto_ibfk_1` FOREIGN KEY (`TblTipoProducto_TipId`) REFERENCES `TblTipoProducto` (`TipProId`), ADD CONSTRAINT `TblProducto_ibfk_2` FOREIGN KEY (`TblEstado_EstId`) REFERENCES `TblEstado` (`EstId`); -- -- Filtros para la tabla `TblProductoPedido` -- ALTER TABLE `TblProductoPedido` ADD CONSTRAINT `TblProductoPedido_ibfk_1` FOREIGN KEY (`TblPedido_PedId`) REFERENCES `TblPedido` (`PedId`), ADD CONSTRAINT `TblProductoPedido_ibfk_2` FOREIGN KEY (`TblProducto_ProRef`) REFERENCES `TblProducto` (`ProRef`); -- -- Filtros para la tabla `TblTipoProducto` -- ALTER TABLE `TblTipoProducto` ADD CONSTRAINT `TblTipoProducto_ibfk_1` FOREIGN KEY (`TblEstado_EstId`) REFERENCES `TblEstado` (`EstId`); -- -- Filtros para la tabla `TblVendedor` -- ALTER TABLE `TblVendedor` ADD CONSTRAINT `TblVendedor_ibfk_1` FOREIGN KEY (`TblEstado_EstId`) REFERENCES `TblEstado` (`EstId`), ADD CONSTRAINT `TblVendedor_ibfk_2` FOREIGN KEY (`TblTipoIdenticacion_TIpId`) REFERENCES `TblTipoIdentificacion` (`TipId`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
SELECT * FROM efforts;
UPDATE section SET location = NULL where LENGTH(location) = 0; UPDATE section SET event_full = NULL where LENGTH(event_full) = 0; UPDATE section SET event_full = 'N' where event_full = 'False'; UPDATE section SET event_full = 'CHECKED' where event_full = 'True'; UPDATE section SET results_entered = NULL where LENGTH(results_entered) = 0; UPDATE section SET results_entered = NULL where results_entered = 'False'; UPDATE section SET results_entered = 'CHECKED' where results_entered = 'True'; UPDATE section SET event_ran = NULL where LENGTH(event_ran) = 0; UPDATE section SET event_ran = NULL where event_ran = 'False'; UPDATE section SET event_ran = 'CHECKED' where event_ran = 'True'; UPDATE section SET advance_to_section = NULL where advance_to_section = 0; UPDATE section SET convention_id = 1;
-- +goose Up -- SQL in section 'Up' is executed when this migration is applied CREATE TABLE `sensors` ( `id` int(11) UNSIGNED NOT NULL COMMENT '管理用', `sensing_device_id` int(11) UNSIGNED NOT NULL COMMENT '機器種別のID', `observable_property_id` int(11) UNSIGNED NOT NULL COMMENT '計測項目のID', `individual_id` int(11) UNSIGNED DEFAULT NULL COMMENT '個体情報のID', `sensor_number` varchar(50) NOT NULL COMMENT 'センサのID', `observation_condition` double(4,1) NOT NULL COMMENT '計測条件(m)', `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '管理用', `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '管理用', `deleted` boolean DEFAULT 0 COMMENT '管理用(論理削除)' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='センサ情報を管理するテーブル'; ALTER TABLE `sensors` ADD PRIMARY KEY (`id`), ADD KEY `sensors_ibfk_2` (`individual_id`), ADD KEY `sensors_ibfk_3` (`observable_property_id`), ADD KEY `sensor_device_id` (`sensing_device_id`), MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '管理用'; -- +goose Down -- SQL section 'Down' is executed when this migration is rolled back DROP TABLE sensors;
USE Scientists; -- 1. Escreva uma query para exibir a string "This is SQL Exercise, Practice and Solution". SELECT 'This is SQL Exercise, Practice and Solution' AS 'Answer'; -- 2. Escreva uma query para exibir três números em três colunas. SELECT 1 AS 'Primeiro número', 2 AS 'Segundo número', 3 AS 'Terceiro número'; -- 3. Escreva uma query para exibir a soma dos números 10 e 15. SELECT 10 + 15 AS 'Soma'; -- 4. Escreva uma query para exibir o resultado de uma expressão aritmética qualquer. SELECT 5 + (10 / 5) AS 'Resultado'; -- 5. Escreva uma query para exibir todas as informações de todos os cientistas. SELECT * FROM Scientists; -- 6. Escreva uma query para exibir o nome como "Nome do Projeto" e as horas como "Tempo de Trabalho" de cada projeto. SELECT Name AS 'Nome do Projeto', Hours AS 'Tempo de Trabalho' FROM Projects; -- 7. Escreva uma query para exibir o nome dos cientistas em ordem alfabética. SELECT Name FROM Scientists ORDER BY Name; -- 8. Escreva uma query para exibir o nome dos Projetos em ordem alfabética descendente. SELECT Name FROM Projects ORDER BY Name DESC; -- 9. Escreva uma query que exiba a string "O projeto Name precisou de Hours horas para ser concluído." para cada projeto. SELECT CONCAT('O projeto ', Name, ' precisou de ', Hours, ' horas para ser concluído') AS 'Tempo para conclusão' FROM Projects; -- 10. Escreva uma query para exibir o nome e as horas dos três projetos com a maior quantidade de horas. SELECT Name, Hours FROM Projects ORDER BY Hours DESC LIMIT 3; -- 11. Escreva uma query para exibir o código de todos os projetos da tabela AssignedTo sem que haja repetições. SELECT DISTINCT(Project) AS 'Código' FROM AssignedTo; -- 12. Escreva uma query para exibir o nome do projeto com maior quantidade de horas. SELECT Name FROM Projects ORDER BY Hours DESC LIMIT 1; -- 13. Escreva uma query para exibir o nome do segundo projeto com menor quantidade de horas. SELECT Name FROM Projects ORDER BY Hours LIMIT 1 OFFSET 1; -- 14. Escreva uma query para exibir todas as informações dos cinco projetos com a menor quantidade de horas. SELECT * FROM Projects ORDER BY Hours LIMIT 5; -- 15. Escreva uma query que exiba a string "Existem Number cientistas na tabela Scientists.", em que Number se refira a quantidade de cientistas. SELECT CONCAT('Existem ', COUNT(*), ' cientistas na tabela Scientists.') AS 'Quantos cientistas existem na tabela Scientists?' FROM Scientists;
CREATE PROCEDURE [actual].[pDel_cmn_department] AS TRUNCATE TABLE [actual].[cmn_department]
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 02, 2019 at 12:53 AM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.3.3 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `kas_baliresin` -- -- -------------------------------------------------------- -- -- Table structure for table `kantor_keluar` -- CREATE TABLE `kantor_keluar` ( `id` int(5) NOT NULL, `jumlah` int(10) NOT NULL, `tanggal` date NOT NULL, `keterangan` varchar(254) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `kantor_keluar` -- INSERT INTO `kantor_keluar` (`id`, `jumlah`, `tanggal`, `keterangan`) VALUES (27, 500000, '2019-07-01', 'Beli HP M-Banking'); -- -------------------------------------------------------- -- -- Table structure for table `kantor_masuk` -- CREATE TABLE `kantor_masuk` ( `id` int(5) NOT NULL, `keterangan` varchar(254) NOT NULL, `tanggal` date NOT NULL, `jumlah` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `kantor_masuk` -- INSERT INTO `kantor_masuk` (`id`, `keterangan`, `tanggal`, `jumlah`) VALUES (43, 'jack', '2019-07-01', 1000000); -- -------------------------------------------------------- -- -- Table structure for table `operasional_keluar` -- CREATE TABLE `operasional_keluar` ( `id` int(5) NOT NULL, `jumlah` int(10) NOT NULL, `tanggal` date NOT NULL, `keterangan` varchar(254) NOT NULL, `tgl_membuat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `operasional_masuk` -- CREATE TABLE `operasional_masuk` ( `id` int(5) NOT NULL, `keterangan` varchar(254) NOT NULL, `tanggal` date NOT NULL, `jumlah` int(10) NOT NULL, `tgl_membuat` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(11) NOT NULL, `name` varchar(100) NOT NULL, `email` varchar(150) NOT NULL, `password` varchar(225) NOT NULL, `image` varchar(150) NOT NULL, `role_id` int(11) NOT NULL, `is_active` int(1) NOT NULL, `date_created` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user` -- INSERT INTO `user` (`id`, `name`, `email`, `password`, `image`, `role_id`, `is_active`, `date_created`) VALUES (30, 'admin', 'admin@gmail.com', '$2y$10$aIdxeVWcM4fO.QzRlhascuEP54beuaCiZte5swALQAovwFHkH1VcC', 'default.jpg', 1, 1, 1564384909); -- -------------------------------------------------------- -- -- Table structure for table `user_access_menu` -- CREATE TABLE `user_access_menu` ( `id` int(11) NOT NULL, `role_id` int(11) NOT NULL, `menu_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_access_menu` -- INSERT INTO `user_access_menu` (`id`, `role_id`, `menu_id`) VALUES (1, 1, 1), (3, 2, 2), (23, 1, 6), (40, 1, 8), (41, 1, 3), (42, 1, 7); -- -------------------------------------------------------- -- -- Table structure for table `user_menu` -- CREATE TABLE `user_menu` ( `id` int(11) NOT NULL, `menu` varchar(128) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_menu` -- INSERT INTO `user_menu` (`id`, `menu`) VALUES (1, 'Admin'), (2, 'User'), (3, 'Menu'), (4, 'test'), (5, 'Produk'), (6, 'Kas Kantor'), (7, 'Laporan'), (8, 'Kas Operasional'); -- -------------------------------------------------------- -- -- Table structure for table `user_role` -- CREATE TABLE `user_role` ( `id` int(11) NOT NULL, `role` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_role` -- INSERT INTO `user_role` (`id`, `role`) VALUES (1, 'Administrator'), (2, 'Member'); -- -------------------------------------------------------- -- -- Table structure for table `user_sub_menu` -- CREATE TABLE `user_sub_menu` ( `id` int(11) NOT NULL, `menu_id` int(11) NOT NULL, `tittle` varchar(128) NOT NULL, `url` varchar(128) NOT NULL, `icon` varchar(128) NOT NULL, `is_active` int(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_sub_menu` -- INSERT INTO `user_sub_menu` (`id`, `menu_id`, `tittle`, `url`, `icon`, `is_active`) VALUES (1, 1, 'Dashboard', 'admin', 'fas fa-fw fa-tachometer-alt', 1), (2, 2, 'My Profile', 'user', 'fas fa-fw fa-user', 1), (3, 2, 'Edit profile', 'user/edit', 'fas fa-fw fa-user-edit', 1), (4, 3, 'Menu Management', 'menu', 'fas fa-fw fa-folder', 1), (5, 3, 'Submenu Management', 'menu/submenu', 'fas fa-fw fa-folder-open', 1), (7, 1, 'Role', 'admin/role', 'fas fa-fw fa-user-tie', 1), (11, 6, 'Kas Masuk', 'kantor/kasmasuk', 'fas fa-plus', 1), (12, 6, 'Kas Keluar', 'kantor/kaskeluar', 'fas fa-minus', 1), (13, 7, 'Laporan Kantor', 'reportkantor/index', 'fas fa-chart-pie', 1), (14, 8, 'Masuk', 'operasional/kasmasuk', 'fas fa-plus', 1), (15, 8, 'Keluar', 'operasional/kaskeluar', 'fas fa-minus', 1), (16, 7, 'Laporan Operasional', 'reportoperasional/index', 'fas fa-chart-area', 1), (17, 7, 'Persentase Laba', 'laba/index', 'fas fa-chart-line', 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `kantor_keluar` -- ALTER TABLE `kantor_keluar` ADD PRIMARY KEY (`id`); -- -- Indexes for table `kantor_masuk` -- ALTER TABLE `kantor_masuk` ADD PRIMARY KEY (`id`); -- -- Indexes for table `operasional_keluar` -- ALTER TABLE `operasional_keluar` ADD PRIMARY KEY (`id`); -- -- Indexes for table `operasional_masuk` -- ALTER TABLE `operasional_masuk` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_access_menu` -- ALTER TABLE `user_access_menu` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_menu` -- ALTER TABLE `user_menu` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_role` -- ALTER TABLE `user_role` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_sub_menu` -- ALTER TABLE `user_sub_menu` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `kantor_keluar` -- ALTER TABLE `kantor_keluar` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28; -- -- AUTO_INCREMENT for table `kantor_masuk` -- ALTER TABLE `kantor_masuk` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44; -- -- AUTO_INCREMENT for table `operasional_keluar` -- ALTER TABLE `operasional_keluar` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `operasional_masuk` -- ALTER TABLE `operasional_masuk` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31; -- -- AUTO_INCREMENT for table `user_access_menu` -- ALTER TABLE `user_access_menu` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43; -- -- AUTO_INCREMENT for table `user_menu` -- ALTER TABLE `user_menu` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; -- -- AUTO_INCREMENT for table `user_role` -- ALTER TABLE `user_role` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `user_sub_menu` -- ALTER TABLE `user_sub_menu` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
create database AUGUR; use AUGUR; ---Tabla: Usuario create table Usuario( idUsuario int not null identity(1,1), nombreUsuario varchar(30), loggin varchar(6), pass varchar(33), bloqueado bit, primary key (idUsuario) ); ---Tabla: LogAcceso create table LogAcceso( idUsuario int not null, fechaHoraAcceso datetime, primary key (idUsuario) ) ---Tabla: Cliente create table Cliente( idCliente int not null identity(1,1), nombreCliente varchar(50), apellidoCliente varchar(50), direccion varchar(50), telefono varchar(10), cedulaPass varchar(10), activoCliente bit, primary key(idCliente) ) ---Tabla: Plato_De_Comida create table PlatoDeComida( idPlatoDeComida int not null identity(1,1), nombrePlato varchar(50), precio money, activoPlato bit, primary key(idPlatoDeComida) ) ---Tabla: Factura create table Factura( idFactura int not null identity(1,1), idCliente int, totalFac money, fechaHoraFac datetime, primary key(idFactura), foreign key(idCliente) references Cliente(idCliente) ) ---Tabla: Pedido create table Pedido( idPedido int not null identity(1,1), idFactura int, idUsuario int, totalPedido money, fechaHoraPedido datetime, primary key(idPedido), foreign key(idFactura) references Factura(idFactura), foreign key(idUsuario) references Usuario(idUsuario) ) ---Tabla: Detalle_Pedido_Platos create table DetallePedidoPlatos( idPlatoDeComida int not null, idPedido int not null, cantidad int not null, foreign key(idPlatoDeComida) references PlatoDeComida(idPlatoDeComida), foreign key(idPedido) references Pedido(idPedido) ) ---Tabla: Ingrediente create table Ingrediente( idIngrediente int not null identity(1,1), nombreIngrediente varchar(50), precio money, activoIngrediente bit, constraint pk_idIngrediente primary key(idIngrediente) ) ---Tabla: Detalle_Plato_Ingrediente create table DetallePlatoIngrediente( idPlatoDeComida int, idIngrediente int, cantidadGramos float, foreign key(idPlatoDeComida) references PlatoDeComida(idPlatoDeComida), foreign key(idIngrediente) references Ingrediente(idIngrediente) ) insert into usuario (nombreUsuario,loggin,pass,bloqueado) values ('Alvaro','admin','0B718FAD51831A032DB50D6B400E2AED',1); -- adminAugur0 insert into usuario (nombreUsuario,loggin,pass,bloqueado) values ('Christian','manag','C247CF6289521E990636035B8B2C878D',1); -- managAugur0 insert into usuario (nombreUsuario,loggin,pass,bloqueado) values ('Michelle','user1','E10B1C9E3AF815F9C4B022CAA5943828',1); --userAugur1 insert into usuario (nombreUsuario,loggin,pass,bloqueado) values ('Diana','user2','BF5FD321E42D604BA444CA51CB0DA219',1); --userAguru2
# phpMyAdmin MySQL-Dump # version 2.2.2 # http://phpwizard.net/phpMyAdmin/ # http://phpmyadmin.sourceforge.net/ (download page) # # Host: localhost # Erstellungszeit: 06. März 2002 um 10:03 # Server Version: 3.23.39 # PHP Version: 4.1.1 # Datenbank : `dmerce_shop2` # -------------------------------------------------------- # # Tabellenstruktur für Tabelle `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;
CREATE OR REPLACE TRIGGER tid_interface_status_AU_STM AFTER UPDATE ON tid_interface_status BEGIN tid_if_status_api.tis_statement_change; -- insert into debugging values ('Invoked tis_statement_change'); END; / SHOW ERRORS
Create proc sp_Delete_SalesmanDetail(@SalesmanID INT) as Delete salesmantarget where salesmanID=@salesmanID
USE CRICKET create table PlayerStats ( Playerid int Not NULL Primary key, Playername varchar(255) ) create table Users (userid int IDENTITY(1,1), username varchar(255), userpassword varchar(255) ) CREATE TABLE Matchessummary ( matchfilename varchar(50) Not NULL , Match_Id int NOT NULL PRIMARY KEY, matchdate varchar(100) NOT NULL, marchbetween varchar(100), matchtype varchar(10), matchgender varchar(10), matchwinner varchar(255), playerofmatch varchar(255), tosswonby varchar(255), tosswinnerdecision varchar(255), umpiresformatch varchar(255), matchlocation varchar(255), matchvenue varchar(255) ) CREATE TABLE temporaryMatchessummary ( matchfilename varchar(50) Not NULL , Match_Id int NOT NULL PRIMARY KEY, matchdate varchar(100) NOT NULL, marchbetween varchar(100), matchtype varchar(10), matchgender varchar(10), matchwinner varchar(255), playerofmatch varchar(255), tosswonby varchar(255), tosswinnerdecision varchar(255), umpiresformatch varchar(255), matchlocation varchar(255), matchvenue varchar(255) ) Create TABLE umpires (UmpireId int IDENTITY(1,1), Umpirename varchar(50), Noofmatches int ) Create TABLE umpirestest ( Umpirename varchar(50) ) Create TABLE venuedetails (venueid int IDENTITY(1,1), venuename varchar(255), matchlocation varchar(255), matchtype varchar(100), matchgender varchar(100), Noofmatchesplayed int, Noofmatchesgotnoresult int, Noofmatcheswonbybattingfirst int, Noofmatcheswonbybattingsecond int ) CREATE Table playerdetails ( playerID int IDENTITY(1,1) Primary key, playername varchar(255), Country varchar(255), noofmatchesplayed int ) CREATE TABLE cricketplayingnations (countryid int IDENTITY(1,1), countryname varchar(255), noofmatcheswon int, noofmatcheslost int, nooftosswon int, Noresultmatches int ) CREATE TABLE CRICKET..batsmendetails ( Match_Id int NOT NULL, innings varchar(50) NOT NULL, country varchar(255), playername varchar(255) NOT NULL, runscored int, ballsplayed int, countof4s int, countof6s int, wicketdetails varchar(255) PRIMARY KEY CLUSTERED ( Match_Id , playername ), FOREIGN KEY ( Match_Id ) REFERENCES Matchessummary ( Match_Id ) ) CREATE TABLE CRICKET..temporarybatsmendetails ( Match_Id int NOT NULL, innings varchar(50) NOT NULL, country varchar(255), playername varchar(255) NOT NULL, runscored int, ballsplayed int, countof4s int, countof6s int, wicketdetails varchar(255) PRIMARY KEY CLUSTERED ( Match_Id , playername ), FOREIGN KEY ( Match_Id ) REFERENCES temporaryMatchessummary ( Match_Id ) ) CREATE table playerbattingdetails ( batsmenid int, batsmenname varchar(255), country varchar(255), noofinningsplayed int, noofnotouts int, noof4s int, noof6s int, totalnoofruns int, totalballsplayed int, highestscore int FOREIGN KEY ( batsmenid ) REFERENCES playerdetails ( playerid ) ) CREATE TABLE bowlingsummary ( Match_Id int NOT NULL, country varchar(255), innings varchar(10) NOT NULL, bowlername varchar(150) NOT NULL, totalballsbowled int, oversbowled numeric, runsgiven int, wicketstaken int, dotballsbowled int, economyrate numeric, widesbowled int, noballsbowled int, countof4sgiven int, countof6sgiven int PRIMARY KEY CLUSTERED ( Match_Id , bowlername ), FOREIGN KEY ( Match_Id ) REFERENCES Matchessummary ( Match_Id ) ) CREATE TABLE temporarybowlingsummary ( Match_Id int NOT NULL, country varchar(255), innings varchar(10) NOT NULL, bowlername varchar(150) NOT NULL, totalballsbowled int, oversbowled numeric, runsgiven int, wicketstaken int, dotballsbowled int, economyrate numeric, widesbowled int, noballsbowled int, countof4sgiven int, countof6sgiven int PRIMARY KEY CLUSTERED ( Match_Id , bowlername ), FOREIGN KEY ( Match_Id ) REFERENCES temporaryMatchessummary ( Match_Id ) ) CREATE TABLE playerbowlingdetails (Bowlerid INT, bowlername varchar(255), country varchar(255), noofinningbowled int, totalballsbowled int, totalrunsgiven int, totalwicketstaken int, totaldotballsbowled int, totalwidesbowled int, totalnoballsbowled int, totalcountof4sgiven int, totalcountof6sgiven int Foreign key(bowlerid ) references playerdetails(playerid) ) CREATE TABLE fallofwickets ( innings varchar(10), wicket varchar(10), playerout varchar(150), outatball numeric, runsscored int, partnership varchar(100), runrate numeric, overplayed numeric, Match_Id int NOT NULL FOREIGN KEY ( Match_Id ) REFERENCES Matchessummary ( Match_Id ) ) CREATE TABLE temporaryfallofwickets ( innings varchar(10) , wicket varchar(10), playerout varchar(150), outatball numeric, runsscored int, partnership varchar(100), runrate numeric, overplayed numeric, Match_Id int NOT NULL FOREIGN KEY ( Match_Id ) REFERENCES temporaryMatchessummary ( Match_Id ) ) CREATE TABLE matchanalysis ( matchbetween varchar(255), interestedteamname varchar(255), opposition varchar(255), match_winner varchar(255), matchgender varchar(255), matchvenue varchar(255), tosswonby varchar(255), tosswinnerdecision varchar(255), interestedbattinginnings varchar(10), playerofmatch varchar(255), totalrunscored int, Highest_score int, totalwicketslost int, toppartnershipwicket varchar(255), toppartnershipruns int )
--DROP VIEW XXMKT.XXMKT_FA_MUTATION#; /* Formatted on 8/4/2020 2:19:29 PM (QP5 v5.256.13226.35538) */ CREATE OR REPLACE FORCE EDITIONING VIEW XXMKT.XXMKT_FA_MUTATION# ( BOOK_TYPE_CODE, SERIAL_NUMBER, DEPRE_CCID, LOCATION_ID, REQUEST_ID, ASSET_ID, TRANSACTION_HEADER_ID, STATUS, ERROR_MESSAGE, GROUP_ID, CREATED_BY, LAST_UPDATED_BY, LAST_UPDATE_LOGIN, CREATION_DATE, LAST_UPDATE_DATE ) AS SELECT BOOK_TYPE_CODE BOOK_TYPE_CODE, SERIAL_NUMBER SERIAL_NUMBER, DEPRE_CCID DEPRE_CCID, LOCATION_ID LOCATION_ID, REQUEST_ID REQUEST_ID, ASSET_ID ASSET_ID, TRANSACTION_HEADER_ID TRANSACTION_HEADER_ID, STATUS STATUS, ERROR_MESSAGE ERROR_MESSAGE, GROUP_ID GROUP_ID, CREATED_BY CREATED_BY, LAST_UPDATED_BY LAST_UPDATED_BY, LAST_UPDATE_LOGIN LAST_UPDATE_LOGIN, CREATION_DATE CREATION_DATE, LAST_UPDATE_DATE LAST_UPDATE_DATE FROM "XXMKT"."XXMKT_FA_MUTATION"; CREATE OR REPLACE SYNONYM APPS.XXMKT_FA_MUTATION FOR XXMKT.XXMKT_FA_MUTATION#; GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE, READ, DEBUG ON XXMKT.XXMKT_FA_MUTATION# TO APPS WITH GRANT OPTION;
INSERT INTO inquiry(name, email, comment, created) VALUES('Ethan', 'sample@example.com', 'Hello', '2019-11-12 08:34:19'); INSERT INTO inquiry(name, email, comment, created) VALUES('Emma', 'sample2@example.com', 'GoodMorning', '2019-12-18 12:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('William', 'sample3@example.com', 'GoodEvening', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER2', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER3', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER4', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry(name, email, comment, created) VALUES('DEBUGGER', 'debug@example.com', 'テスト中', '2019-12-18 15:10:52'); INSERT INTO inquiry_reply(inquiry_id, name, email, comment, created) VALUES(1, '管理人', 'manager@example.com', 'Hello thank you!', '2019-11-13 08:34:19'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('ken', 20, 1, 1, 5, 'Good!', '2019-01-03 11:02:35'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('lisa', 30, 3, 2, 4, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('ryota', 25, 2, 1, 4, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 11, 1, 2, 2, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 21, 2, 1, 3, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 31, 2, 2, 4, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 41, 3, 1, 5, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 51, 3, 2, 1, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 61, 4, 1, 3, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 11, 1, 2, 4, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 10, 1, 1, 5, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 30, 2, 2, 2, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO survey(name, age, profession, ismen, satisfaction, comment, created) VALUES('debug', 40, 2, 1, 1, 'Excellent', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('初めてのブログ', 'メイン', 'ブログ始めました。よろしくお願いします。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('人員募集します!!', '〇〇制作委員会', 'こんにちは。人員を募集します。SE、PGの方はメール(programer@example.com)の方へ連絡のほど、よろしくお願いします。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('DEBUG', 'テスト', 'テスト。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('DEBUG', 'テスト', 'テスト。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('DEBUG', 'テスト', 'テスト。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('DEBUG', 'テスト', 'テスト。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('DEBUG', 'テスト', 'テスト。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('DEBUG', 'テスト', 'テスト。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_main(title, tag, comment, thanksCnt, created, updated) VALUES('DEBUG', 'テスト', 'テスト。', 0, '2019-02-18 22:35:54', '2019-02-18 22:35:54'); INSERT INTO blog_tag(tag) VALUES('全て'); INSERT INTO blog_tag(tag) VALUES('メイン'); INSERT INTO blog_tag(tag) VALUES('〇〇制作委員会'); INSERT INTO blog_tag(tag) VALUES('テスト'); INSERT INTO blog_reply(commentid, name, comment, thanksCnt, created) VALUES(1, '管理人', 'Hello thank you!', 0, '2019-11-13 08:34:19');
-- MySQL dump 10.13 Distrib 8.0.20, for Linux (x86_64) -- -- Host: localhost Database: lab_cloud -- ------------------------------------------------------ -- Server version 8.0.20-0ubuntu0.20.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 */; /*!50503 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `lab_dept` -- DROP TABLE IF EXISTS `lab_dept`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `lab_dept` ( `DEPT_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '部门ID', `PARENT_ID` bigint NOT NULL COMMENT '上级部门ID', `DEPT_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门名称', `ORDER_NUM` double(20,0) DEFAULT NULL COMMENT '排序', `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间', `MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`DEPT_ID`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='部门表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lab_dept` -- LOCK TABLES `lab_dept` WRITE; /*!40000 ALTER TABLE `lab_dept` DISABLE KEYS */; INSERT INTO `lab_dept` VALUES (1,0,'开发部',1,'2018-01-04 15:42:26','2019-01-05 21:08:27'); /*!40000 ALTER TABLE `lab_dept` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lab_menu` -- DROP TABLE IF EXISTS `lab_menu`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `lab_menu` ( `MENU_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '菜单/按钮ID', `PARENT_ID` bigint NOT NULL COMMENT '上级菜单ID', `MENU_NAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单/按钮名称', `PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '对应路由path', `COMPONENT` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '对应路由组件component', `PERMS` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '权限标识', `ICON` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '图标', `TYPE` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型 0菜单 1按钮', `ORDER_NUM` double(20,0) DEFAULT NULL COMMENT '排序', `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', `MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`MENU_ID`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='菜单表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lab_menu` -- LOCK TABLES `lab_menu` WRITE; /*!40000 ALTER TABLE `lab_menu` DISABLE KEYS */; INSERT INTO `lab_menu` VALUES (1,0,'系统管理','/system','Layout',NULL,'el-icon-set-up','0',1,'2017-12-27 16:39:07','2019-07-20 16:19:04'),(2,1,'用户管理','/system/user','febs/system/user/Index','user:view','','0',1,'2017-12-27 16:47:13','2019-01-22 06:45:55'),(3,2,'新增用户','','','user:add',NULL,'1',NULL,'2017-12-27 17:02:58',NULL),(4,2,'修改用户','','','user:update',NULL,'1',NULL,'2017-12-27 17:04:07',NULL),(5,2,'删除用户','','','user:delete',NULL,'1',NULL,'2017-12-27 17:04:58',NULL); /*!40000 ALTER TABLE `lab_menu` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lab_role` -- DROP TABLE IF EXISTS `lab_role`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `lab_role` ( `ROLE_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID', `ROLE_NAME` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称', `REMARK` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '角色描述', `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', `MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`ROLE_ID`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='角色表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lab_role` -- LOCK TABLES `lab_role` WRITE; /*!40000 ALTER TABLE `lab_role` DISABLE KEYS */; INSERT INTO `lab_role` VALUES (1,'管理员','管理员','2019-08-08 16:23:11','2019-08-09 14:38:59'); /*!40000 ALTER TABLE `lab_role` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lab_role_menu` -- DROP TABLE IF EXISTS `lab_role_menu`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `lab_role_menu` ( `ROLE_ID` bigint NOT NULL, `MENU_ID` bigint NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='角色菜单关联表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lab_role_menu` -- LOCK TABLES `lab_role_menu` WRITE; /*!40000 ALTER TABLE `lab_role_menu` DISABLE KEYS */; INSERT INTO `lab_role_menu` VALUES (1,1),(1,2),(1,3),(1,4),(1,5); /*!40000 ALTER TABLE `lab_role_menu` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lab_user` -- DROP TABLE IF EXISTS `lab_user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `lab_user` ( `USER_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', `USERNAME` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名', `PASSWORD` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', `DEPT_ID` bigint DEFAULT NULL COMMENT '部门ID', `EMAIL` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱', `MOBILE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系电话', `STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态 0锁定 1有效', `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', `MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', `LAST_LOGIN_TIME` datetime DEFAULT NULL COMMENT '最近访问时间', `SSEX` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '性别 0男 1女 2保密', `AVATAR` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像', `DESCRIPTION` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '描述', PRIMARY KEY (`USER_ID`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lab_user` -- LOCK TABLES `lab_user` WRITE; /*!40000 ALTER TABLE `lab_user` DISABLE KEYS */; INSERT INTO `lab_user` VALUES (1,'yangbing','$2a$10$QZJiiIaDbthSPeUbfoPp7OEUj3cHm8B9L.e8I8ZPPOutyPAaSKs/G',1,'mrbird@qq.com','17788888888','1','2019-06-14 20:39:22','2019-07-19 10:18:36','2019-08-02 15:57:00','0','default.jpg','我是帅比作者。'); /*!40000 ALTER TABLE `lab_user` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `lab_user_role` -- DROP TABLE IF EXISTS `lab_user_role`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `lab_user_role` ( `USER_ID` bigint NOT NULL COMMENT '用户ID', `ROLE_ID` bigint NOT NULL COMMENT '角色ID' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户角色关联表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `lab_user_role` -- LOCK TABLES `lab_user_role` WRITE; /*!40000 ALTER TABLE `lab_user_role` DISABLE KEYS */; INSERT INTO `lab_user_role` VALUES (1,1); /*!40000 ALTER TABLE `lab_user_role` ENABLE KEYS */; UNLOCK TABLES; -- -- Dumping routines for database 'lab_cloud' -- /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-07-15 7:07:14
CREATE TABLE `ipv4` ( `ip_from` bigint(11) NOT NULL DEFAULT '0', `ip_to` bigint(11) NOT NULL, `country` varchar(32) COLLATE utf8_bin NOT NULL, `region` varchar(128) COLLATE utf8_bin NOT NULL, `city` varchar(128) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`ip_from`,`ip_to`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- This will add secret_key to your database, incase you're using the base.sql file. alter table `gameservers` add `secret_key` varchar(64) null after `goldpanda`
SELECT year FROM Movies, Rating WHERE Movies.mID = Rating.mID AND (stars = 4 or stars = 5) ORDER BY year
CREATE OR REPLACE VIEW V1_JH001_HZ AS (SELECT "CZDE202","DE007","DE011","DE022",sum(de181) as de181,to_char(JSDE999,'YYYY-MM-DD') as JSDE999 FROM jh001 where czde202 is not null and JSDE940<80 group by "CZDE202","DE007","DE011","DE022" ,to_char(JSDE999,'YYYY-MM-DD'));
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: 2016-01-06 13:02:25 -- 服务器版本: 10.1.9-MariaDB -- PHP Version: 5.6.15 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `sms` -- -- -------------------------------------------------------- -- -- 表的结构 `class` -- CREATE TABLE `class` ( `class_id` int(11) NOT NULL, `dept` varchar(20) DEFAULT NULL, `grade` varchar(20) DEFAULT NULL, `year` varchar(10) DEFAULT NULL, `class_name` varchar(10) DEFAULT NULL, `major` varchar(20) DEFAULT NULL, `sta_id` int(11) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `class` -- INSERT INTO `class` (`class_id`, `dept`, `grade`, `year`, `class_name`, `major`, `sta_id`, `intro`) VALUES (1, '计算机', '0', '2013', '计科2班', '计科', 20130002, '2013计算机计科2班'), (2, '计算机', '0', '2015', '计科2班', '计科', 20130003, '2015计算机计科2班'); -- -------------------------------------------------------- -- -- 表的结构 `class_leader` -- CREATE TABLE `class_leader` ( `class_id` int(11) NOT NULL, `stu_id` int(11) NOT NULL, `is_monitor` int(1) DEFAULT NULL, `position` varchar(10) DEFAULT NULL, `power` varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `course` -- CREATE TABLE `course` ( `course_id` int(11) NOT NULL, `course` varchar(20) DEFAULT NULL, `tea_id` int(11) DEFAULT NULL, `classroom` varchar(20) DEFAULT NULL, `teach_time` varchar(20) DEFAULT NULL, `total_time` varchar(20) DEFAULT NULL, `course_year_term` varchar(10) DEFAULT NULL, `property` varchar(20) DEFAULT NULL, `credit` varchar(10) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `course` -- INSERT INTO `course` (`course_id`, `course`, `tea_id`, `classroom`, `teach_time`, `total_time`, `course_year_term`, `property`, `credit`, `intro`) VALUES (1, 'C++语言程序设计', 54140001, 'A1301', '112', '第1周到第18周 ', '20151', '必修课', '4.0', 'C++语言程序是程序猿的基础课程\r\n '), (2, 'Java程序设计', 54140002, 'A2302', '234', '第1周到第18周 ', '20151', '辅修课', '3.0', 'Java程序设计,上过的人都说好\r\n '), (3, '数据库', 54140002, 'A1301', '356', '第1周到第18周 ', '20151', '必修课', '4.0', '数据库是一门高深课程\r\n '), (4, '数据结构', 54140003, 'A2301', '378', '第1周到第18周 ', '20151', '必修课', '4.0', '数据结构是一门高深课程\r\n '), (5, '算法设计', 54140004, 'A1201', '412', '第1周到第18周 ', '20151', '必修课', '4.0', '算法设计是一门高深的课程\r\n '); -- -------------------------------------------------------- -- -- 表的结构 `emp_basic_info` -- CREATE TABLE `emp_basic_info` ( `sta_id` int(11) NOT NULL, `sta_name` varchar(20) DEFAULT NULL, `sex` char(1) DEFAULT 'm', `entry_time` varchar(20) DEFAULT NULL, `position` varchar(20) DEFAULT NULL, `power` varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `emp_basic_info` -- INSERT INTO `emp_basic_info` (`sta_id`, `sta_name`, `sex`, `entry_time`, `position`, `power`) VALUES (20130001, '吴智强', '男', '2013', '教务员', ''), (20130002, '陈明宇', '男', '2013', '辅导员', ''), (20130003, '陈琦琦', '女', '2012', '辅导员', ''), (20130004, '王大力', '男', '2014', '教务员', ''), (20130344, '黄炳麟', '男', '2013', '办公室', '4'); -- -------------------------------------------------------- -- -- 表的结构 `emp_identification_info` -- CREATE TABLE `emp_identification_info` ( `sta_id` int(11) NOT NULL, `address` varchar(50) DEFAULT NULL, `birth` varchar(20) DEFAULT NULL, `id_no` varchar(18) DEFAULT NULL, `race` varchar(10) DEFAULT NULL, `polit` varchar(10) DEFAULT NULL, `native_place` varchar(20) DEFAULT NULL, `tel` varchar(20) DEFAULT NULL, `health` varchar(10) DEFAULT NULL, `experience` varchar(120) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL, `password` varchar(40) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `emp_identification_info` -- INSERT INTO `emp_identification_info` (`sta_id`, `address`, `birth`, `id_no`, `race`, `polit`, `native_place`, `tel`, `health`, `experience`, `intro`, `password`) VALUES (20130001, '广州', '2000/2/2', '445224200002021121', '汉', '党员', '广东', '18888888888', '良好', '大学本科', '', '000000'), (20130002, '', '', '', '', '', '', '', '', '', '', '000000'), (20130003, '', '', '', '', '', '', '', '', '', '', '000000'), (20130004, '广州', '1945/4/4', '514862533485454758', '朝鲜族', '党员', '东北', '15687542106', '良好', '东北大学', '', '000000'), (20130344, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '000000'); -- -------------------------------------------------------- -- -- 表的结构 `evaluate` -- CREATE TABLE `evaluate` ( `eva_id` int(11) NOT NULL, `eva_year_term` varchar(10) DEFAULT NULL, `is_over` tinyint(1) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `evaluate_list` -- CREATE TABLE `evaluate_list` ( `eva_one_id` int(11) NOT NULL, `eva_id` int(11) DEFAULT NULL, `eva_stu_id` int(11) DEFAULT NULL, `score` int(4) DEFAULT NULL, `context` varchar(300) DEFAULT NULL, `time` varchar(20) DEFAULT NULL, `eva_course_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `financial_account` -- CREATE TABLE `financial_account` ( `money_id` int(11) NOT NULL, `money_time` varchar(20) DEFAULT NULL, `get_in_from` varchar(20) DEFAULT NULL, `in_out` varchar(10) DEFAULT NULL, `cur_money` int(30) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL, `sta_id` int(11) DEFAULT NULL, `req_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `financial_report` -- CREATE TABLE `financial_report` ( `req_id` int(11) NOT NULL, `req_type` varchar(10) DEFAULT NULL, `req_res_group_id` int(11) DEFAULT NULL, `req_time` varchar(20) DEFAULT NULL, `req_money` int(10) DEFAULT NULL, `req_intro` varchar(300) DEFAULT NULL, `verify_statue` varchar(20) DEFAULT NULL, `verify_time` varchar(20) DEFAULT NULL, `sta_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `message` -- CREATE TABLE `message` ( `message_id` varchar(20) NOT NULL, `message_title` varchar(30) DEFAULT NULL, `message_text` varchar(300) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `message_interconnect` -- CREATE TABLE `message_interconnect` ( `trans_id` int(11) NOT NULL, `message_id` varchar(20) DEFAULT NULL, `src_type` varchar(10) DEFAULT NULL, `src_stu_id` int(11) DEFAULT NULL, `tar_type` varchar(10) DEFAULT NULL, `tar_stu_id` int(11) DEFAULT NULL, `send_time` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `res_group` -- CREATE TABLE `res_group` ( `res_group_id` int(11) NOT NULL, `res_group_name` varchar(20) DEFAULT NULL, `tea_id` int(11) DEFAULT NULL, `project` varchar(20) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `res_group_achievement` -- CREATE TABLE `res_group_achievement` ( `result_id` int(11) NOT NULL, `res_group_id` int(11) DEFAULT NULL, `result_time` varchar(20) DEFAULT NULL, `result_intro` varchar(300) DEFAULT NULL, `verify_statue` varchar(20) DEFAULT NULL, `tea_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `res_group_log` -- CREATE TABLE `res_group_log` ( `log_id` int(11) NOT NULL, `res_group_id` int(11) DEFAULT NULL, `create_date` varchar(20) DEFAULT NULL, `update_date` varchar(20) DEFAULT NULL, `member_id` varchar(20) DEFAULT NULL, `log_content` varchar(120) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `res_member` -- CREATE TABLE `res_member` ( `member_id` varchar(20) NOT NULL, `res_group_id` int(11) DEFAULT NULL, `member_type` varchar(20) DEFAULT NULL, `stu_id` int(11) DEFAULT NULL, `tea_id` int(11) DEFAULT NULL, `power` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `stu_award` -- CREATE TABLE `stu_award` ( `stu_id` int(11) DEFAULT NULL, `award_time` varchar(20) DEFAULT NULL, `award_name` varchar(20) DEFAULT NULL, `award_intro` varchar(300) DEFAULT NULL, `verify_statue` varchar(20) DEFAULT NULL, `award_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `stu_basic_info` -- CREATE TABLE `stu_basic_info` ( `stu_id` int(11) NOT NULL, `stu_name` varchar(20) DEFAULT NULL, `sex` char(1) DEFAULT 'm', `class_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `stu_basic_info` -- INSERT INTO `stu_basic_info` (`stu_id`, `stu_name`, `sex`, `class_id`) VALUES (2013010001, '萝莉姐\r\n ', '女', 1), (2013010002, '董阿朋\r\n ', '男', 1), (2013010003, '洪阿狗\r\n ', '男', 1), (2013010004, '谢阿杰\r\n ', '男', 1), (2015020001, '林思宏\r\n ', '男', 2), (2015020002, '陈耀培\r\n ', '男', 2), (2015020003, '陈源\r\n ', '男', 2), (2015020004, '林俊杰\r\n ', '男', 2), (2015020005, '李涵\r\n ', '男', 2), (2015020006, '林超\r\n ', '女', 2); -- -------------------------------------------------------- -- -- 表的结构 `stu_course` -- CREATE TABLE `stu_course` ( `course_id` int(11) NOT NULL, `stu_id` int(11) NOT NULL, `score` varchar(10) DEFAULT NULL, `is_fail` char(1) DEFAULT '0', `is_evaluate` tinyint(1) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `stu_course` -- INSERT INTO `stu_course` (`course_id`, `stu_id`, `score`, `is_fail`, `is_evaluate`) VALUES (1, 2015020001, '-1', '0', 0), (2, 2015020001, '-1', '0', 0), (3, 2015020001, '-1', '0', 0), (4, 2015020001, '-1', '0', 0), (5, 2015020001, '-1', '0', 0); -- -------------------------------------------------------- -- -- 表的结构 `stu_evaluate` -- CREATE TABLE `stu_evaluate` ( `stu_id` int(11) NOT NULL, `course_year_term` varchar(10) NOT NULL, `avg_score` float(6,4) DEFAULT NULL, `gain_credit` int(10) DEFAULT NULL, `gpd` float(6,4) DEFAULT NULL, `class_rank` int(5) DEFAULT NULL, `grade_rank` int(5) DEFAULT NULL, `fail_num` int(4) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `stu_identification_info` -- CREATE TABLE `stu_identification_info` ( `stu_id` int(11) NOT NULL, `loc` varchar(10) DEFAULT NULL, `birth` varchar(20) DEFAULT NULL, `id_no` varchar(18) DEFAULT NULL, `race` varchar(10) DEFAULT NULL, `polit` varchar(10) DEFAULT NULL, `native_place` varchar(20) DEFAULT NULL, `tel` varchar(20) DEFAULT NULL, `health` varchar(10) DEFAULT NULL, `enroll_time` varchar(20) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL, `password` varchar(40) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `stu_identification_info` -- INSERT INTO `stu_identification_info` (`stu_id`, `loc`, `birth`, `id_no`, `race`, `polit`, `native_place`, `tel`, `health`, `enroll_time`, `intro`, `password`) VALUES (2013010001, '', '', '', '', '', '', '', '', '', '', '000000'), (2013010002, '', '', '', '', '', '', '', '', '', '', '000000'), (2013010003, '', '', '', '', '', '', '', '', '', '', '000000'), (2013010004, '', '', '', '', '', '', '', '', '', '', '000000'), (2015020001, '', '', '', '', '', '', '', '', '', '', '000000'), (2015020002, '', '', '', '', '', '', '', '', '', '', '000000'), (2015020003, '', '', '', '', '', '', '', '', '', '', '000000'), (2015020004, '', '', '', '', '', '', '', '', '', '', '000000'), (2015020005, '', '', '', '', '', '', '', '', '', '', '000000'), (2015020006, '', '', '', '', '', '', '', '', '', '', '000000'); -- -------------------------------------------------------- -- -- 表的结构 `stu_union` -- CREATE TABLE `stu_union` ( `group_id` int(11) NOT NULL, `group_name` varchar(20) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `stu_union` -- INSERT INTO `stu_union` (`group_id`, `group_name`, `intro`) VALUES (1, '学生创新俱乐部', ''); -- -------------------------------------------------------- -- -- 表的结构 `stu_union_act` -- CREATE TABLE `stu_union_act` ( `act_id` int(11) NOT NULL, `group_id` int(11) DEFAULT NULL, `act_name` varchar(12) DEFAULT NULL, `act_time` varchar(20) DEFAULT NULL, `act_position` varchar(20) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- 表的结构 `stu_union_member` -- CREATE TABLE `stu_union_member` ( `group_id` int(11) NOT NULL, `stu_id` int(11) NOT NULL, `is_leader` int(1) DEFAULT NULL, `gro_position` varchar(20) DEFAULT NULL, `power` varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `stu_union_member` -- INSERT INTO `stu_union_member` (`group_id`, `stu_id`, `is_leader`, `gro_position`, `power`) VALUES (1, 2015020001, 1, '创设人', '4'); -- -------------------------------------------------------- -- -- 表的结构 `teacher_award` -- CREATE TABLE `teacher_award` ( `award_id` int(11) NOT NULL, `tea_id` int(11) DEFAULT NULL, `award_time` varchar(20) DEFAULT NULL, `award_name` varchar(20) DEFAULT NULL, `verify_statue` varchar(20) DEFAULT NULL, `award_intro` varchar(300) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `teacher_award` -- INSERT INTO `teacher_award` (`award_id`, `tea_id`, `award_time`, `award_name`, `verify_statue`, `award_intro`) VALUES (1, 54140001, '20131', 'MVP', '未审核', 'NBA MVP'); -- -------------------------------------------------------- -- -- 表的结构 `teacher_basic_info` -- CREATE TABLE `teacher_basic_info` ( `tea_id` int(11) NOT NULL, `tea_name` varchar(20) DEFAULT NULL, `sex` char(1) DEFAULT 'm', `rank` varchar(20) DEFAULT NULL, `entry_time` varchar(20) DEFAULT NULL, `authority` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `teacher_basic_info` -- INSERT INTO `teacher_basic_info` (`tea_id`, `tea_name`, `sex`, `rank`, `entry_time`, `authority`) VALUES (54140001, '马千里', '男', NULL, NULL, '4'), (54140002, '隆承志', '男', '教授', '2005', '1'), (54140003, '沃妍', '女', '副教授', '2001', '0'), (54140004, '刘鹏', '男', '讲师', '2011', '0'); -- -------------------------------------------------------- -- -- 表的结构 `teacher_identification_info` -- CREATE TABLE `teacher_identification_info` ( `tea_id` int(11) NOT NULL, `address` varchar(50) DEFAULT NULL, `birth` varchar(20) DEFAULT NULL, `id_no` varchar(18) DEFAULT NULL, `race` varchar(10) DEFAULT NULL, `polit` varchar(10) DEFAULT NULL, `native_place` varchar(20) DEFAULT NULL, `tel` varchar(20) DEFAULT NULL, `health` varchar(10) DEFAULT NULL, `experience` varchar(120) DEFAULT NULL, `intro` varchar(300) DEFAULT NULL, `password` varchar(40) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- 转存表中的数据 `teacher_identification_info` -- INSERT INTO `teacher_identification_info` (`tea_id`, `address`, `birth`, `id_no`, `race`, `polit`, `native_place`, `tel`, `health`, `experience`, `intro`, `password`) VALUES (54140001, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '000000'), (54140002, '', '', '', '', '', '', '', '', '', '', '000000'), (54140003, '', '', '', '', '', '', '', '', '', '', '000000'), (54140004, '', '', '', '', '', '', '', '', '', '', '000000'); -- -- Indexes for dumped tables -- -- -- Indexes for table `class` -- ALTER TABLE `class` ADD PRIMARY KEY (`class_id`), ADD KEY `class_fk` (`sta_id`); -- -- Indexes for table `class_leader` -- ALTER TABLE `class_leader` ADD PRIMARY KEY (`class_id`,`stu_id`), ADD KEY `class_leader_fk2` (`stu_id`); -- -- Indexes for table `course` -- ALTER TABLE `course` ADD PRIMARY KEY (`course_id`), ADD KEY `course_fk` (`tea_id`); -- -- Indexes for table `emp_basic_info` -- ALTER TABLE `emp_basic_info` ADD PRIMARY KEY (`sta_id`); -- -- Indexes for table `emp_identification_info` -- ALTER TABLE `emp_identification_info` ADD PRIMARY KEY (`sta_id`); -- -- Indexes for table `evaluate` -- ALTER TABLE `evaluate` ADD PRIMARY KEY (`eva_id`); -- -- Indexes for table `evaluate_list` -- ALTER TABLE `evaluate_list` ADD PRIMARY KEY (`eva_one_id`), ADD KEY `evaluate_list_fk1` (`eva_id`), ADD KEY `evaluate_list_fk2` (`eva_stu_id`); -- -- Indexes for table `financial_account` -- ALTER TABLE `financial_account` ADD PRIMARY KEY (`money_id`), ADD KEY `financial_account_fk1` (`sta_id`), ADD KEY `financial_account_fk2` (`req_id`); -- -- Indexes for table `financial_report` -- ALTER TABLE `financial_report` ADD PRIMARY KEY (`req_id`), ADD KEY `financial_report_fk` (`req_res_group_id`); -- -- Indexes for table `message` -- ALTER TABLE `message` ADD PRIMARY KEY (`message_id`); -- -- Indexes for table `message_interconnect` -- ALTER TABLE `message_interconnect` ADD PRIMARY KEY (`trans_id`), ADD KEY `message_interconnect_fk1` (`message_id`), ADD KEY `message_interconnect_fk7` (`src_stu_id`); -- -- Indexes for table `res_group` -- ALTER TABLE `res_group` ADD PRIMARY KEY (`res_group_id`), ADD KEY `res_group_fk` (`tea_id`); -- -- Indexes for table `res_group_achievement` -- ALTER TABLE `res_group_achievement` ADD PRIMARY KEY (`result_id`), ADD KEY `res_group_achievement_fk1` (`res_group_id`), ADD KEY `res_group_achievement_fk2` (`tea_id`); -- -- Indexes for table `res_group_log` -- ALTER TABLE `res_group_log` ADD PRIMARY KEY (`log_id`), ADD KEY `res_group_log_fk1` (`res_group_id`), ADD KEY `res_group_log_fk2` (`member_id`); -- -- Indexes for table `res_member` -- ALTER TABLE `res_member` ADD PRIMARY KEY (`member_id`), ADD KEY `res_member_fk1` (`tea_id`), ADD KEY `res_member_fk2` (`stu_id`), ADD KEY `res_member_fk3` (`res_group_id`); -- -- Indexes for table `stu_award` -- ALTER TABLE `stu_award` ADD PRIMARY KEY (`award_id`), ADD KEY `stu_award_fk` (`stu_id`); -- -- Indexes for table `stu_basic_info` -- ALTER TABLE `stu_basic_info` ADD PRIMARY KEY (`stu_id`), ADD KEY `stu_basic_info_fk` (`class_id`); -- -- Indexes for table `stu_course` -- ALTER TABLE `stu_course` ADD PRIMARY KEY (`course_id`,`stu_id`), ADD KEY `stu_course_fk2` (`stu_id`); -- -- Indexes for table `stu_evaluate` -- ALTER TABLE `stu_evaluate` ADD PRIMARY KEY (`stu_id`,`course_year_term`); -- -- Indexes for table `stu_identification_info` -- ALTER TABLE `stu_identification_info` ADD PRIMARY KEY (`stu_id`); -- -- Indexes for table `stu_union` -- ALTER TABLE `stu_union` ADD PRIMARY KEY (`group_id`); -- -- Indexes for table `stu_union_act` -- ALTER TABLE `stu_union_act` ADD PRIMARY KEY (`act_id`), ADD KEY `stu_union_act_fk` (`group_id`); -- -- Indexes for table `stu_union_member` -- ALTER TABLE `stu_union_member` ADD PRIMARY KEY (`group_id`,`stu_id`), ADD KEY `stu_union_member_fk2` (`stu_id`); -- -- Indexes for table `teacher_award` -- ALTER TABLE `teacher_award` ADD PRIMARY KEY (`award_id`), ADD KEY `teacher_award_fk` (`tea_id`); -- -- Indexes for table `teacher_basic_info` -- ALTER TABLE `teacher_basic_info` ADD PRIMARY KEY (`tea_id`); -- -- Indexes for table `teacher_identification_info` -- ALTER TABLE `teacher_identification_info` ADD PRIMARY KEY (`tea_id`); -- -- 在导出的表使用AUTO_INCREMENT -- -- -- 使用表AUTO_INCREMENT `class` -- ALTER TABLE `class` MODIFY `class_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- 使用表AUTO_INCREMENT `course` -- ALTER TABLE `course` MODIFY `course_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- 使用表AUTO_INCREMENT `evaluate` -- ALTER TABLE `evaluate` MODIFY `eva_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `evaluate_list` -- ALTER TABLE `evaluate_list` MODIFY `eva_one_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `financial_account` -- ALTER TABLE `financial_account` MODIFY `money_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `financial_report` -- ALTER TABLE `financial_report` MODIFY `req_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `message_interconnect` -- ALTER TABLE `message_interconnect` MODIFY `trans_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `res_group` -- ALTER TABLE `res_group` MODIFY `res_group_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `res_group_achievement` -- ALTER TABLE `res_group_achievement` MODIFY `result_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `res_group_log` -- ALTER TABLE `res_group_log` MODIFY `log_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `stu_award` -- ALTER TABLE `stu_award` MODIFY `award_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `stu_union` -- ALTER TABLE `stu_union` MODIFY `group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- 使用表AUTO_INCREMENT `stu_union_act` -- ALTER TABLE `stu_union_act` MODIFY `act_id` int(11) NOT NULL AUTO_INCREMENT; -- -- 使用表AUTO_INCREMENT `teacher_award` -- ALTER TABLE `teacher_award` MODIFY `award_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- 限制导出的表 -- -- -- 限制表 `class` -- ALTER TABLE `class` ADD CONSTRAINT `class_fk` FOREIGN KEY (`sta_id`) REFERENCES `emp_basic_info` (`sta_id`); -- -- 限制表 `class_leader` -- ALTER TABLE `class_leader` ADD CONSTRAINT `class_leader_fk1` FOREIGN KEY (`class_id`) REFERENCES `class` (`class_id`), ADD CONSTRAINT `class_leader_fk2` FOREIGN KEY (`stu_id`) REFERENCES `stu_basic_info` (`stu_id`); -- -- 限制表 `course` -- ALTER TABLE `course` ADD CONSTRAINT `course_fk` FOREIGN KEY (`tea_id`) REFERENCES `teacher_basic_info` (`tea_id`); -- -- 限制表 `emp_identification_info` -- ALTER TABLE `emp_identification_info` ADD CONSTRAINT `emp_identification_info_fk` FOREIGN KEY (`sta_id`) REFERENCES `emp_basic_info` (`sta_id`); -- -- 限制表 `evaluate_list` -- ALTER TABLE `evaluate_list` ADD CONSTRAINT `evaluate_list_fk1` FOREIGN KEY (`eva_id`) REFERENCES `evaluate` (`eva_id`), ADD CONSTRAINT `evaluate_list_fk2` FOREIGN KEY (`eva_stu_id`) REFERENCES `stu_basic_info` (`stu_id`); -- -- 限制表 `financial_account` -- ALTER TABLE `financial_account` ADD CONSTRAINT `financial_account_fk1` FOREIGN KEY (`sta_id`) REFERENCES `emp_basic_info` (`sta_id`), ADD CONSTRAINT `financial_account_fk2` FOREIGN KEY (`req_id`) REFERENCES `financial_report` (`req_id`); -- -- 限制表 `financial_report` -- ALTER TABLE `financial_report` ADD CONSTRAINT `financial_report_fk` FOREIGN KEY (`req_res_group_id`) REFERENCES `teacher_basic_info` (`tea_id`); -- -- 限制表 `message_interconnect` -- ALTER TABLE `message_interconnect` ADD CONSTRAINT `message_interconnect_fk1` FOREIGN KEY (`message_id`) REFERENCES `message` (`message_id`), ADD CONSTRAINT `message_interconnect_fk2` FOREIGN KEY (`src_stu_id`) REFERENCES `stu_basic_info` (`stu_id`), ADD CONSTRAINT `message_interconnect_fk3` FOREIGN KEY (`src_stu_id`) REFERENCES `teacher_basic_info` (`tea_id`), ADD CONSTRAINT `message_interconnect_fk4` FOREIGN KEY (`src_stu_id`) REFERENCES `stu_union` (`group_id`), ADD CONSTRAINT `message_interconnect_fk5` FOREIGN KEY (`src_stu_id`) REFERENCES `res_group` (`res_group_id`), ADD CONSTRAINT `message_interconnect_fk6` FOREIGN KEY (`src_stu_id`) REFERENCES `emp_basic_info` (`sta_id`), ADD CONSTRAINT `message_interconnect_fk7` FOREIGN KEY (`src_stu_id`) REFERENCES `class` (`class_id`); -- -- 限制表 `res_group` -- ALTER TABLE `res_group` ADD CONSTRAINT `res_group_fk` FOREIGN KEY (`tea_id`) REFERENCES `teacher_basic_info` (`tea_id`); -- -- 限制表 `res_group_achievement` -- ALTER TABLE `res_group_achievement` ADD CONSTRAINT `res_group_achievement_fk1` FOREIGN KEY (`res_group_id`) REFERENCES `res_group` (`res_group_id`), ADD CONSTRAINT `res_group_achievement_fk2` FOREIGN KEY (`tea_id`) REFERENCES `teacher_basic_info` (`tea_id`); -- -- 限制表 `res_group_log` -- ALTER TABLE `res_group_log` ADD CONSTRAINT `res_group_log_fk1` FOREIGN KEY (`res_group_id`) REFERENCES `res_group` (`res_group_id`), ADD CONSTRAINT `res_group_log_fk2` FOREIGN KEY (`member_id`) REFERENCES `res_member` (`member_id`); -- -- 限制表 `res_member` -- ALTER TABLE `res_member` ADD CONSTRAINT `res_member_fk1` FOREIGN KEY (`tea_id`) REFERENCES `teacher_basic_info` (`tea_id`), ADD CONSTRAINT `res_member_fk2` FOREIGN KEY (`stu_id`) REFERENCES `stu_basic_info` (`stu_id`), ADD CONSTRAINT `res_member_fk3` FOREIGN KEY (`res_group_id`) REFERENCES `res_group` (`res_group_id`); -- -- 限制表 `stu_award` -- ALTER TABLE `stu_award` ADD CONSTRAINT `stu_award_fk` FOREIGN KEY (`stu_id`) REFERENCES `stu_basic_info` (`stu_id`); -- -- 限制表 `stu_basic_info` -- ALTER TABLE `stu_basic_info` ADD CONSTRAINT `stu_basic_info_fk` FOREIGN KEY (`class_id`) REFERENCES `class` (`class_id`); -- -- 限制表 `stu_course` -- ALTER TABLE `stu_course` ADD CONSTRAINT `stu_course_fk1` FOREIGN KEY (`course_id`) REFERENCES `course` (`course_id`), ADD CONSTRAINT `stu_course_fk2` FOREIGN KEY (`stu_id`) REFERENCES `stu_basic_info` (`stu_id`); -- -- 限制表 `stu_evaluate` -- ALTER TABLE `stu_evaluate` ADD CONSTRAINT `stu_evaluate_fk` FOREIGN KEY (`stu_id`) REFERENCES `stu_basic_info` (`stu_id`); -- -- 限制表 `stu_identification_info` -- ALTER TABLE `stu_identification_info` ADD CONSTRAINT `stu_id_info_fk` FOREIGN KEY (`stu_id`) REFERENCES `stu_basic_info` (`stu_id`); -- -- 限制表 `stu_union_act` -- ALTER TABLE `stu_union_act` ADD CONSTRAINT `stu_union_act_fk` FOREIGN KEY (`group_id`) REFERENCES `stu_union` (`group_id`); -- -- 限制表 `stu_union_member` -- ALTER TABLE `stu_union_member` ADD CONSTRAINT `stu_union_member_fk1` FOREIGN KEY (`group_id`) REFERENCES `stu_union` (`group_id`), ADD CONSTRAINT `stu_union_member_fk2` FOREIGN KEY (`stu_id`) REFERENCES `stu_basic_info` (`stu_id`); -- -- 限制表 `teacher_award` -- ALTER TABLE `teacher_award` ADD CONSTRAINT `teacher_award_fk` FOREIGN KEY (`tea_id`) REFERENCES `teacher_basic_info` (`tea_id`); -- -- 限制表 `teacher_identification_info` -- ALTER TABLE `teacher_identification_info` ADD CONSTRAINT `teacher_identification_info_fk` FOREIGN KEY (`tea_id`) REFERENCES `teacher_basic_info` (`tea_id`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Gép: 127.0.0.1 -- Létrehozás ideje: 2018. Júl 28. 17:07 -- Kiszolgáló verziója: 10.1.19-MariaDB -- PHP verzió: 5.6.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 */; -- -- Adatbázis: `udalosti` -- -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `cennik` -- CREATE TABLE `cennik` ( `idCennik` int(11) NOT NULL, `vaha` int(11) NOT NULL, `suma` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `pouzivatel` -- CREATE TABLE `pouzivatel` ( `idPouzivatel` int(11) NOT NULL, `meno` varchar(20) COLLATE utf8_slovak_ci NOT NULL, `email` varchar(255) COLLATE utf8_slovak_ci NOT NULL, `pohlavie` enum('m','z') COLLATE utf8_slovak_ci NOT NULL, `obrazok` varchar(128) COLLATE utf8_slovak_ci NOT NULL, `heslo` varchar(128) COLLATE utf8_slovak_ci NOT NULL, `idTelefonu` text COLLATE utf8_slovak_ci NOT NULL, `token` text COLLATE utf8_slovak_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `pozvanka` -- CREATE TABLE `pozvanka` ( `idPozvanka` int(11) NOT NULL, `idUdalost` int(11) NOT NULL, `idPouzivatelAkcia` int(11) NOT NULL, `idPouzivatelOdpoved` int(11) NOT NULL, `precitana` tinyint(4) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `rola` -- CREATE TABLE `rola` ( `idRola` int(11) NOT NULL, `nazov` varchar(20) COLLATE utf8_slovak_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `rola_pouzivatela` -- CREATE TABLE `rola_pouzivatela` ( `idRolaPouzivatela` int(11) NOT NULL, `idPouzivatel` int(11) NOT NULL, `idRola` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `udalost` -- CREATE TABLE `udalost` ( `idUdalost` int(11) NOT NULL, `idCennik` int(11) NOT NULL, `obrazok` varchar(128) COLLATE utf8_slovak_ci NOT NULL, `nazov` varchar(30) COLLATE utf8_slovak_ci NOT NULL, `datum` date NOT NULL, `cas` time NOT NULL, `stat` varchar(20) COLLATE utf8_slovak_ci NOT NULL, `okres` varchar(20) COLLATE utf8_slovak_ci NOT NULL, `mesto` varchar(20) COLLATE utf8_slovak_ci NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `vztah` -- CREATE TABLE `vztah` ( `idVztah` int(11) NOT NULL, `idPouzivatelAkcia` int(11) NOT NULL, `idPouzivatelOdpoved` int(11) NOT NULL, `status` int(11) NOT NULL, `akcia` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -------------------------------------------------------- -- -- Tábla szerkezet ehhez a táblához `zaujem` -- CREATE TABLE `zaujem` ( `idZaujem` int(11) NOT NULL, `idUdalost` int(11) NOT NULL, `idPouzivatel` int(11) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci; -- -- Indexek a kiírt táblákhoz -- -- -- A tábla indexei `cennik` -- ALTER TABLE `cennik` ADD PRIMARY KEY (`idCennik`); -- -- A tábla indexei `pouzivatel` -- ALTER TABLE `pouzivatel` ADD PRIMARY KEY (`idPouzivatel`); -- -- A tábla indexei `pozvanka` -- ALTER TABLE `pozvanka` ADD PRIMARY KEY (`idPozvanka`); -- -- A tábla indexei `rola` -- ALTER TABLE `rola` ADD PRIMARY KEY (`idRola`); -- -- A tábla indexei `rola_pouzivatela` -- ALTER TABLE `rola_pouzivatela` ADD PRIMARY KEY (`idRolaPouzivatela`); -- -- A tábla indexei `udalost` -- ALTER TABLE `udalost` ADD PRIMARY KEY (`idUdalost`); -- -- A tábla indexei `vztah` -- ALTER TABLE `vztah` ADD PRIMARY KEY (`idVztah`); -- -- A tábla indexei `zaujem` -- ALTER TABLE `zaujem` ADD PRIMARY KEY (`idZaujem`); -- -- A kiírt táblák AUTO_INCREMENT értéke -- -- -- AUTO_INCREMENT a táblához `cennik` -- ALTER TABLE `cennik` MODIFY `idCennik` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT a táblához `pouzivatel` -- ALTER TABLE `pouzivatel` MODIFY `idPouzivatel` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT a táblához `pozvanka` -- ALTER TABLE `pozvanka` MODIFY `idPozvanka` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT a táblához `rola` -- ALTER TABLE `rola` MODIFY `idRola` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT a táblához `rola_pouzivatela` -- ALTER TABLE `rola_pouzivatela` MODIFY `idRolaPouzivatela` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT a táblához `udalost` -- ALTER TABLE `udalost` MODIFY `idUdalost` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT a táblához `vztah` -- ALTER TABLE `vztah` MODIFY `idVztah` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT a táblához `zaujem` -- ALTER TABLE `zaujem` MODIFY `idZaujem` int(11) NOT NULL AUTO_INCREMENT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 4.5.4.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: May 16, 2018 at 04:13 PM -- Server version: 5.7.11 -- PHP Version: 5.6.18 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `foodbank` drop database foodbank; -- CREATE DATABASE IF NOT EXISTS `foodbank` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `foodbank`; -- -------------------------------------------------------- -- -- Table structure for table `application_details` -- DROP TABLE IF EXISTS `application_details`; CREATE TABLE `application_details` ( `vol_no` int(3) NOT NULL, `OneOff` tinyint(1) DEFAULT NULL, `OnetoFour` tinyint(1) DEFAULT NULL, `Days` varchar(50) DEFAULT NULL, `otherAvailability` varchar(75) DEFAULT NULL, `why_interested` varchar(150) NOT NULL, `previous_work` varchar(100) DEFAULT NULL, `health_problems` varchar(100) DEFAULT NULL, `PVG` tinyint(1) DEFAULT NULL, `convictions` varchar(150) DEFAULT NULL, `further_info` varchar(100) DEFAULT NULL, `hear_about_FB` varchar(50) DEFAULT NULL, `date_applied` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `checklist_actions` -- DROP TABLE IF EXISTS `checklist_actions`; CREATE TABLE `checklist_actions` ( `vol_no` int(3) NOT NULL, `actions` varchar(75) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `checklist_once_started` -- DROP TABLE IF EXISTS `checklist_once_started`; CREATE TABLE `checklist_once_started` ( `vol_no` int(3) NOT NULL, `once_started` varchar(75) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `further_details` -- DROP TABLE IF EXISTS `further_details`; CREATE TABLE `further_details` ( `vol_no` int(3) NOT NULL, `why_interested` varchar(100) NOT NULL, `working_towards_award` varchar(30) DEFAULT NULL, `PVG` tinyint(1) DEFAULT NULL, `convictions` varchar(50) DEFAULT NULL, `further_info` varchar(75) DEFAULT NULL, `hear_about_FB` varchar(100) NOT NULL, `vol_area` varchar(40) NOT NULL, `start_date` date NOT NULL, `regular_days` varchar(50) NOT NULL, `supervisor` varchar(20) NOT NULL, `buddy` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `interests` -- DROP TABLE IF EXISTS `interests`; CREATE TABLE `interests` ( `interest_no` int(3) NOT NULL, `interest_areas` varchar(60) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `volunteer_details` -- DROP TABLE IF EXISTS `volunteer_details`; CREATE TABLE `volunteer_details` ( `vol_no` int(3) NOT NULL, `title` varchar(15) NOT NULL, `forename` varchar(20) NOT NULL, `surname` varchar(25) NOT NULL, `address1` varchar(40) NOT NULL, `postcode` varchar(8) NOT NULL, `tel_no` varchar(12) NOT NULL, `email` varchar(30) NOT NULL, `DOB` date NOT NULL, `EM_name` varchar(20) NOT NULL, `EM_tel` varchar(20) NOT NULL, `EM_rel` varchar(30) NOT NULL, `R1_name` varchar(20) NOT NULL, `R1_email` varchar(40) NOT NULL, `R1_tel` varchar(12) NOT NULL, `R1_rel` varchar(20) NOT NULL, `R2_name` varchar(20) DEFAULT NULL, `R2_email` varchar(30) DEFAULT NULL, `R2_tel` varchar(12) DEFAULT NULL, `R2_rel` varchar(20) DEFAULT NULL, `vol_status` varchar(10) DEFAULT NULL, `address2` varchar(75) DEFAULT NULL, `town` varchar(35) DEFAULT NULL, `awards` varchar(150) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `vol_interests` -- DROP TABLE IF EXISTS `vol_interests`; CREATE TABLE `vol_interests` ( `vol_no` int(3) NOT NULL, `interest_no` int(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `vol_weekly_hours` -- DROP TABLE IF EXISTS `vol_weekly_hours`; CREATE TABLE `vol_weekly_hours` ( `vol_no` int(3) NOT NULL, `date_` date NOT NULL, `day_` varchar(20) NOT NULL, `hours` int(2) NOT NULL, `area` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `application_details` -- ALTER TABLE `application_details` ADD PRIMARY KEY (`vol_no`); -- -- Indexes for table `checklist_actions` -- ALTER TABLE `checklist_actions` ADD PRIMARY KEY (`vol_no`,`actions`); -- -- Indexes for table `checklist_once_started` -- ALTER TABLE `checklist_once_started` ADD PRIMARY KEY (`vol_no`,`once_started`); -- -- Indexes for table `further_details` -- ALTER TABLE `further_details` ADD PRIMARY KEY (`vol_no`); -- -- Indexes for table `interests` -- ALTER TABLE `interests` ADD PRIMARY KEY (`interest_no`); -- -- Indexes for table `volunteer_details` -- ALTER TABLE `volunteer_details` ADD PRIMARY KEY (`vol_no`); -- -- Indexes for table `vol_interests` -- ALTER TABLE `vol_interests` ADD PRIMARY KEY (`vol_no`,`interest_no`), ADD KEY `interest_no` (`interest_no`); -- -- Indexes for table `vol_weekly_hours` -- ALTER TABLE `vol_weekly_hours` ADD PRIMARY KEY (`vol_no`,`date_`,`day_`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `interests` -- ALTER TABLE `interests` MODIFY `interest_no` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `volunteer_details` -- ALTER TABLE `volunteer_details` MODIFY `vol_no` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=87; -- -- Constraints for dumped tables -- -- -- Constraints for table `application_details` -- ALTER TABLE `application_details` ADD CONSTRAINT `application_details_ibfk_1` FOREIGN KEY (`vol_no`) REFERENCES `volunteer_details` (`vol_no`); -- -- Constraints for table `checklist_actions` -- ALTER TABLE `checklist_actions` ADD CONSTRAINT `checklist_actions_ibfk_1` FOREIGN KEY (`vol_no`) REFERENCES `volunteer_details` (`vol_no`); -- -- Constraints for table `checklist_once_started` -- ALTER TABLE `checklist_once_started` ADD CONSTRAINT `checklist_once_started_ibfk_1` FOREIGN KEY (`vol_no`) REFERENCES `volunteer_details` (`vol_no`); -- -- Constraints for table `vol_interests` -- ALTER TABLE `vol_interests` ADD CONSTRAINT `vol_interests_ibfk_1` FOREIGN KEY (`vol_no`) REFERENCES `volunteer_details` (`vol_no`), ADD CONSTRAINT `vol_interests_ibfk_2` FOREIGN KEY (`interest_no`) REFERENCES `interests` (`interest_no`); -- -- Constraints for table `vol_weekly_hours` -- ALTER TABLE `vol_weekly_hours` ADD CONSTRAINT `vol_weekly_hours_ibfk_1` FOREIGN KEY (`vol_no`) REFERENCES `volunteer_details` (`vol_no`); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE TABLE student ( stId INT ( 11 ) NOT NULL AUTO_INCREMENT COMMENT "id", stName VARCHAR ( 50 ) NOT NULL COMMENT "姓名", stAge INT ( 2 ) NOT NULL COMMENT "年龄", stPhoneNo VARCHAR ( 11 ) DEFAULT "000000" COMMENT "手机", stGender VARCHAR ( 4 ) NOT NULL COMMENT "性别", stClass VARCHAR ( 30 ) NOT NULL COMMENT "班级", stHome VARCHAR ( 100 ) COMMENT "家庭住址", PRIMARY KEY ( stId ) ) ENGINE = INNODB AUTO_INCREMENT = 100 DEFAULT CHARSET = utf8; INSERT INTO `student` VALUES ('100', 'admin', '22', '000000', '男', '二年1班', '中央大街'); INSERT INTO `student` VALUES ('101', '太乙真人', '1098', '13312346767', '男', '高三2班', '乾元山金光洞'); INSERT INTO `student` VALUES ('102', '度厄真人', '996', '13367679000', '男', '高二5班', '九顶铁刹山八宝云光洞'); INSERT INTO `student` VALUES ('103', '慈航真人', '1022', '18798326183', '女', '高三8班', '普陀山紫竹林'); INSERT INTO `student` VALUES ('104', '姜子牙', '63', '000000', '男', '初三1班', '镐京中央大街324号'); INSERT INTO `student` VALUES ('105', '多宝道人', '2800', '13186986711', '男', '高三5班', '东海蓬莱岛紫芝崖碧游宫'); INSERT INTO `student` VALUES ('106', '赵公明', '720', '17129847835', '男', '高三2班', '峨嵋山罗浮洞'); INSERT INTO `student` VALUES ('107', '金灵圣母', '1022', '15189673478', '女', '高三1班', '普陀山紫竹林'); INSERT INTO `student` VALUES ('108', '月游星君', '700', '000000', '女', '初三2班', null); INSERT INTO `student` VALUES ('109', '文殊广法天尊', '1125', '000000', '男', '高三1班', '五龙山云霄洞'); INSERT INTO `student` VALUES ('110', '邓婵玉', '26', '18922226731', '女', '三年6班', null); INSERT INTO `student` VALUES ('111', '云霄', '928', '000000', '女', '高二2班', '三仙岛'); INSERT INTO `student` VALUES ('112', '琼霄', '927', '000000', '女', '高二2班', '三仙岛'); INSERT INTO `student` VALUES ('113', '碧霄', '919', '000000', '女', '高二2班', '三仙岛');
CREATE TABLE festival ( festa_img VARCHAR2(100) NOT NULL, --이미지파일 이름.jpg festa_name VARCHAR2(100) PRIMARY KEY, --축제이름 festa_period VARCHAR2(30) NOT NULL, --기간(yyyy.mm.dd~yyyy.mm.dd) festa_content VARCHAR2(1000), --축제 상세설명 festa_tel VARCHAR2(30), --기관 전화번호 festa_url VARCHAR2(50), --홈페이지 url festa_address VARCHAR2(100) NOT NULL, --상세주소 festa_location VARCHAR2(100) NOT NULL, --행사장소 festa_host VARCHAR2(300), --주최 festa_charge VARCHAR2(50) DEFAULT('무료'), --요금(입력하지 않을경우 DEFAULT 무료) festa_coodinate VARCHAR2(100) NOT NULL --좌표(위도,경도) ); ALTER TABLE festival MODIFY festa_img VARCHAR2(100) UNIQUE; DELETE TABLE festival; INSERT INTO festival VALUES( 'chrismas.jpg', '부산 크리스마스 문화축제', '2020.12.05~2021.01.19', '2009년 시작된 부산크리스마스트리문화축제가 12회째를 맞이했다.트리축제라는 이름처럼 빛의 향연이 광복동 거리를 화려하게 수놓고, 문화축제라는 이름처럼 매일밤 아름다운 노래와 화려한 공연으로 시민들을 맞이한다. 60만개의 LED전구를 사용한 화려한 거리의 트리들이 추운 겨울, 우리의 마음을 따뜻하게 만든다.', '051-243-3927', 'http://bctf.co.kr', '부산광역시 중구 광복로 58-2', '부산 광복로, 부평동, 보수동', '(사)부산기독교총연합회, 부산크리스마스트리문화축제조직위원회', '무료', '35.0996,129.0314'); INSERT INTO festival VALUES( 'dongback.jpg', '마노르블랑 동백스케치 동백꽃축제', '2020.11.25~2021.02.14', '마노르블랑에서는 매년 동백꽃축제가 열리고 있지만 올해는 더더욱 특별한 동백꽃 축제가 열린다. 올해엔 작년부터 준비해 온 동백스케치를 개장했다. 기존 동백꽃 대비 20배가 넘는 엄청난 규모의 동백꽃들이 기다리고 있다.', '064-794-0999', 'https://manorblanc.modoo.at/', '제주특별자치도 서귀포시 안덕면 일주서로2100번길 46', '마노르블랑', '마노르블랑', '초등학생이상 3500원', '33.2544,126.2945'); INSERT INTO festival VALUES( 'songuh.jpg', '파주 송어 축제', '2021.01.01~2021.02.07', '가족과함께연인과함께 멋진 추억을 만들어보자 겨울에만 즐길수있는 송어 산천어얼음낚시체험 눈썰매 전통얼음썰매 송어 산천어맨손잡기체험 어린이빙어잡기체험 등 다양한 볼거리와 체험을통해 가적 연인 모두가 행복한 추억을 만들어보자', '1522-1531', 'http://www.pjtf.co.kr', '경기도 파주시 광탄면 부흥로 194-42', '광탄레저타운', '광탄레저타운', '중학생이상 17000원', '37.8017,126.8661'); INSERT INTO festival VALUES( 'tulip.jpg', '태안 세계 튤립 공원', '2020.04.14~2020.05.11', '2020 태안 세계튤립공원은 디즈니 애니메이션을 모티브로 큰 틀을 잡았다.아렌델 궁전에 홀로 남겨진 겨울왕국의 엘사! 모글리가 출장? 간 사이 다양한 동물들이 뛰노는 숲속의 정글북!', '041-675-5533', 'http://www.koreaflowerpark.com', '충청남도 태안군 안면읍 꽃지해안로 400', '코리아플라워파크', '태안꽃축제추진위원회', '성인:12,000원', '36.4984,126.3372'); INSERT INTO festival VALUES( 'apple.jpg', '영주 사과 축제', '2020.10.24~2020.11.01', '시원한 가을 바람속에 스며든 상큼한 사과향, 새콤달콤 아삭한 식감은 풍성한 세월과 섞여 새로운 풍미를 전달한다.영주사과축제장에서 현대인들의 스트레스 해소와 건강, 그리고 별미를 찾는 관광객들에게 해방감과 맛의 극치를 선사한다.', '054-630-8711', 'http://apple.yctf.or.kr/', '경북 영주시 시민운동장 및 서천둔치', '부석사', '영주시', '무료', '36.8087,128.6077'); INSERT INTO festival VALUES( 'nightview.jpg', '제주 유리의 성 별빛축제 야간개장', '2020.12.01~2021.01.31', '화려한 유리와 빛의 조화가 펼쳐지는 꿈의나라 유리의성에서 보는 환상적인 빛의축제!! 아름다운 빛과 찬란하게 반짝이는 밤이 찾아오면 우리에게 마법같은 시간이 펼쳐진다.', '064-772-7777', 'http://www.jejuglasscastle.com', '제주특별자치도 제주시 한경면 녹차분재로 462', '제주유리의성', '유리의성', '성인11,000원', '33.3150,126.2734'); COMMIT; SELECT * FROM festival;
-- phpMyAdmin SQL Dump -- version 4.5.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Nov 18, 2016 at 09:07 AM -- Server version: 10.1.16-MariaDB -- PHP Version: 5.6.24 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `restaurantDB` -- -- -------------------------------------------------------- -- -- Table structure for table `cuisine` -- CREATE TABLE `cuisine` ( `cuisine_id` bigint(20) UNSIGNED NOT NULL, `cuisine` varchar(25) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `cuisine` -- INSERT INTO `cuisine` (`cuisine_id`, `cuisine`) VALUES (1, 'Italian'), (2, 'Pizza'), (3, 'Mexican'), (4, 'Tex-Mex'), (5, 'Steakhouse'), (6, 'Sushi'), (7, 'American'), (8, 'Pub Fare'), (9, 'Asian'), (10, 'Breakfast'), (11, ' '); -- -------------------------------------------------------- -- -- Table structure for table `neighborhood` -- CREATE TABLE `neighborhood` ( `neighborhood_id` bigint(20) UNSIGNED NOT NULL, `neighborhood_name` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `neighborhood` -- INSERT INTO `neighborhood` (`neighborhood_id`, `neighborhood_name`) VALUES (1, 'Highlands'), (2, 'Germantown'), (3, 'St. Matthews'), (4, 'Downtown'), (5, 'Jeffersontown'), (6, 'Jeffersonville'), (7, 'New Albany'), (8, 'Prospect'), (9, 'Shively'), (10, 'Fourth Street'), (11, 'Fern Valley'), (12, 'Iroquois'), (13, 'Original Highlands'), (14, ' '); -- -------------------------------------------------------- -- -- Table structure for table `restaurants` -- CREATE TABLE `restaurants` ( `rest_id` bigint(20) UNSIGNED NOT NULL, `rest_name` varchar(40) NOT NULL, `neighborhood_id` int(3) DEFAULT '14', `cuisine_id` int(3) DEFAULT '11', `new_to_me` enum('yes','no') DEFAULT 'no' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `restaurants` -- INSERT INTO `restaurants` (`rest_id`, `rest_name`, `neighborhood_id`, `cuisine_id`, `new_to_me`) VALUES (1, 'For Goodness Crepes', 13, 10, 'no'), (2, 'Simply Thai', 3, 9, 'no'), (3, '&quot;', 0, 0, ''), (7, 'sfd', 0, 0, ''), (8, 'test', 0, 0, 'no'), (9, 'FABD', 3, 8, 'no'), (11, 'FABDs', 0, 0, 'no'), (17, '$testing&quot;&lt;bold&gt;', 0, 0, 'no'), (18, 'pleaseworkpleaseworkpleasework', 0, 0, 'no'), (19, 'pleaseworkpleaseworkpleaseworkPLEASE!!!!', 0, 0, 'no'); -- -- Indexes for dumped tables -- -- -- Indexes for table `cuisine` -- ALTER TABLE `cuisine` ADD PRIMARY KEY (`cuisine_id`), ADD UNIQUE KEY `cuisine_id` (`cuisine_id`); -- -- Indexes for table `neighborhood` -- ALTER TABLE `neighborhood` ADD PRIMARY KEY (`neighborhood_id`), ADD UNIQUE KEY `neighborhood_id` (`neighborhood_id`); -- -- Indexes for table `restaurants` -- ALTER TABLE `restaurants` ADD PRIMARY KEY (`rest_id`), ADD UNIQUE KEY `rest_id` (`rest_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `cuisine` -- ALTER TABLE `cuisine` MODIFY `cuisine_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `neighborhood` -- ALTER TABLE `neighborhood` MODIFY `neighborhood_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `restaurants` -- ALTER TABLE `restaurants` MODIFY `rest_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE TABLE muestra ( codigo NVARCHAR(3), cedula NVARCHAR(11), nombre NVARCHAR(30), edad int, sexo NVARCHAR(11), fecha NVARCHAR(14), resultado NVARCHAR(11) );
CREATE TABLE `employee_settle_detail` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `settle_no` varchar(50) DEFAULT NULL COMMENT '账单编号', `order_id` varchar(50) DEFAULT NULL COMMENT '订单编码', `trans_no` varchar(50) DEFAULT NULL COMMENT '交易流水号', `account_code` int(10) DEFAULT NULL COMMENT '账户', `account_name` varchar(20) DEFAULT NULL COMMENT '账户名称', `card_id` int(11) DEFAULT NULL COMMENT '卡号', `mer_code` varchar(20) DEFAULT NULL COMMENT '商户代码', `mer_name` varchar(50) DEFAULT NULL COMMENT '商户名称', `store_code` varchar(20) DEFAULT NULL COMMENT '门店编码', `store_name` varchar(50) DEFAULT NULL COMMENT '门店名称', `trans_time` datetime NOT NULL COMMENT '交易时间', `pos` varchar(20) DEFAULT NULL COMMENT 'pos机器编码', `pay_code` varchar(20) DEFAULT NULL COMMENT '支付编码', `pay_name` varchar(50) DEFAULT NULL COMMENT '支付名称', `trans_type` varchar(20) DEFAULT NULL COMMENT '交易类型', `trans_type_name` varchar(20) DEFAULT NULL COMMENT '交易类型名', `trans_amount` decimal(10,2) DEFAULT NULL COMMENT '交易金额', `mer_account_type` varchar(20) DEFAULT NULL COMMENT '福利类型(个人授信,个人授信溢缴款)', `mer_account_type_name` varchar(20) DEFAULT NULL COMMENT '福利类型(个人授信,个人授信溢缴款)', `account_amount` decimal(10,2) DEFAULT NULL COMMENT '子账户扣款金额', `account_balance` decimal(10,2) DEFAULT NULL COMMENT '子账户余额', `mer_deduction_amount` decimal(20,2) DEFAULT NULL COMMENT '商户余额扣款金额', `mer_credit_deduction_amount` decimal(10,2) DEFAULT NULL COMMENT '商户信用扣款金额', `settle_flag` varchar(20) DEFAULT NULL COMMENT '结算标志 settled已结算 settling结算中 unsettled未结算', `order_channel` varchar(20) DEFAULT NULL COMMENT '订单渠道', `create_user` varchar(50) DEFAULT NULL COMMENT '创建人', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_user` varchar(50) DEFAULT NULL COMMENT '更新人', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `version` int(11) DEFAULT NULL COMMENT '版本', `mer_credit` decimal(10,2) DEFAULT NULL COMMENT '商户授信额度', `mer_balance` decimal(10,2) DEFAULT NULL COMMENT '商户余额', `store_type` varchar(20) NOT NULL COMMENT '门店类型(自营:self,第三方:third)', `account_deduction_amount_id` bigint(20) NOT NULL COMMENT '用户交易流水明细表主键', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; create index idx_esd_trans_no on employee_settle_detail(trans_no); create index idx_esd_trans_time on employee_settle_detail(trans_time); create index idx_esd_settle_no on employee_settle_detail(settle_no); create unique index uk_account_deduction_amount_id on employee_settle_detail(account_deduction_amount_id); CREATE TABLE `employee_settle` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', `settle_no` varchar(50) DEFAULT NULL COMMENT '账单编号', `settle_period` varchar(50) DEFAULT NULL COMMENT '账单周期', `mer_code` varchar(20) DEFAULT NULL COMMENT '商户代码', `account_code` bigint(20) COMMENT '账户号', `trans_amount` decimal(10,2) DEFAULT NULL COMMENT '交易金额', `settle_amount` decimal(10,2) DEFAULT NULL COMMENT '结算金额', `order_num` int(11) DEFAULT NULL COMMENT '交易笔数', `settle_status` varchar(20) DEFAULT NULL COMMENT '结算状态(结算中-settling;已结算-settled)', `send_time` datetime DEFAULT NULL COMMENT '发送时间', `confirm_time` datetime DEFAULT NULL COMMENT '确定时间', `settle_start_time` datetime DEFAULT NULL COMMENT '账单开始时间', `settle_end_time` datetime DEFAULT NULL COMMENT '账单结束时间', `create_user` varchar(20) DEFAULT NULL COMMENT '创建人', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_user` varchar(20) DEFAULT NULL COMMENT '更新人', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `deleted` tinyint(1) DEFAULT NULL COMMENT '删除标志', `build_time` datetime DEFAULT NULL COMMENT '生成时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='商户员工结算账单'; create index idx_es_settle_no on employee_settle(settle_no); create index idx_build_time on employee_settle(build_time); alter table account_amount_type modify mer_account_type_code varchar(32) null comment '商家账户类型'; alter table account_deduction_detail modify mer_account_type varchar(32) null comment '子账户类型(例如餐费、交通费等)'; alter table account_deposit_apply modify mer_account_type_code varchar(32) null comment '商家账户类型'; alter table merchant_account_type modify mer_account_type_code varchar(32) not null comment '商户账户类型编码'; alter table settle_detail modify mer_account_type varchar(32) null comment '福利类型(餐费、交通费等)'; alter table employee_settle_detail modify mer_account_type varchar(32) null comment '福利类型(个人授信,个人授信溢缴款)'; alter table account_bill_detail add column surplus_quota_overpay decimal(10,2) comment '个人授信溢缴款' after surplus_quota; alter table account add column surplus_quota_overpay decimal(10,2) DEFAULT 0.00 comment '个人授信溢缴款' after surplus_quota; alter table supplier_store add mobile varchar(32) null comment '门店手机号'; ### DML insert into account_amount_type (id, account_code, mer_account_type_code, account_balance, deleted, create_user, create_time, update_user, update_time, version) select aat.id-1000000000000000000, aat.account_code, 'surplus_quota_overpay', 0, 0, 'anonymous', now(), null, null, 0 from account_amount_type aat where aat.mer_account_type_code = 'surplus_quota'; insert into merchant_account_type (id, mer_code, mer_account_type_code, mer_account_type_name, deduction_order, deleted, remark, create_user, create_time, update_user, update_time, version, show_status) select mat.id-1000000000000000000, mat.mer_code, 'surplus_quota_overpay', '员工授信额度溢缴额', 9000, 0, null, 'anonymous', now(), null, null, 0, 0 from merchant_account_type mat where mat.mer_account_type_code = 'surplus_quota'; #新增字段赋初始值 update account a set a.surplus_quota_overpay = 0; #新增字段赋初始值 update account_bill_detail a set a.surplus_quota_overpay = 0; INSERT INTO `sequence`(`id`, `sequence_type`, `prefix`, `sequence_no`, `min_sequence`, `max_sequence`, `handler_for_max`, `create_user`, `create_time`, `update_user`, `update_time`, `deleted`, `version`) VALUES (12, 'employee_settle_no', NULL, 1000000000, 1000000000, 9999999999, 'com.welfare.service.sequence.CommonMaxHandler', 'anonymous', '2021-03-08 16:59:23', 'zxadmin', '2021-03-16 10:44:35', 0, 0);
CREATE TABLE `regs` ( `nick` varchar(30) NOT NULL, `email` varchar(100) NOT NULL, `secret` blob, `pwd` varchar(60) DEFAULT NULL, `added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`nick`) );
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prc_ClientPortal_ArchiveMessage]') AND type in (N'P')) DROP PROCEDURE [dbo].[prc_ClientPortal_ArchiveMessage] GO CREATE PROC prc_ClientPortal_ArchiveMessage @UserID int ,@RootMessageID int ,@ErrorMessage varchar(500) OUT AS SET NOCOUNT ON; BEGIN TRY INSERT INTO CWI_PortalUserMessageArchive (PortalUserID, MessageID, ArchiveDate) VALUES (@UserID, @RootMessageID, GetDate()) END TRY BEGIN CATCH SELECT @ErrorMessage = ERROR_MESSAGE() END CATCH GO
create database if not exists produitdb; use produitdb; drop table if exists Produit; drop table if exists Categorie; create table Categorie( id integer primary key auto_increment , label VARCHAR(64) ); create table Produit( id integer primary key auto_increment , label VARCHAR(64), prix double, cat integer, constraint categorie_valide foreign key (cat) references Categorie(id) ); insert into Categorie(id,label) values (1,'ordinateur'), (2,'imprimante'), (3,'disque dur'); insert into Produit(id,label,prix,cat) values (1,'ordinateur 1', 678.8 , 1 ), (2,'imprimante 1', 234 , 2), (3,'disque dur 1', 56.7 , 3), (4,'ordinateur 2', 978.8 , 1 ), (5,'imprimante 2', 134 , 2), (6,'disque dur 2', 96.7 , 3), (7,'ordinateur 3', 478.8 , 1 ), (8,'imprimante 3', 334 , 2), (9,'disque dur 3', 86.7 , 3); #show tables; #describe Categorie; select * from Categorie; #describe Produit; select * from Produit;
TRUNCATE TABLE WL_INFO_OPSWARE_LOAD; TRUNCATE TABLE INFO_TURKUAZ_LOAD; TRUNCATE TABLE WL_SCRIPT_JDBC; TRUNCATE TABLE WL_SCRIPT_JDBC_DETAIL; TRUNCATE TABLE TOMCAT_SCRIPT_DETAIL; TRUNCATE TABLE APACHE_SCRIPT_VIRTUALHOSTS; TRUNCATE TABLE WL_SCRIPT_PROCESS_LOAD; TRUNCATE TABLE APACHE_SCRIPT_PROCESS_LOAD; TRUNCATE TABLE TOMCAT_SCRIPT_PROCESS_LOAD; TRUNCATE TABLE SCRIPT_USER_LIMITS; TRUNCATE TABLE SCRIPT_LOG; TRUNCATE TABLE APX_ASA.SCRIPT_BLACKLIST_LOAD; EXIT;
-- dup_role_users.sql -- generate DDL to duplicate a set of users granted a particular role(s) -- -- the section that grants table priviliges only -- works for a single schema owner -- col cowner noprint new_value uowner col crolename noprint new_value urolename prompt This script generates a script to duplicate all users that have prompt been granted a particular role of set of roles prompt prompt the default for the password is the same as the username prompt there is a line to uncomment that will use the real password prompt prompt This script will only do the table grants for a single schema owner prompt which is fine for most uses of this script prompt prompt Shema Owner? : set term off feed off select upper('&1') cowner from dual; set term on feed on prompt Duplicate users assigned this Role[s] prompt ( you may use the wildcard character '%' ) : set term off feed off select upper('&2') crolename from dual; set term on feed on @clear_for_spool spool _dup_role_users.sql prompt prompt prompt -- create user prompt prompt prompt set echo on feed on term on prompt prompt prompt Duplicating Users/Quota/System Privileges For All Users Of Roles Like '&urolename' prompt prompt prompt Granting Table Privileges To All Users Of Tables Owned by '&uowner' prompt prompt That Are Also Assigned To Roles Like '&urolename' prompt select distinct 'create user ' || grantee --|| ' identified by ' || grantee || ' identified by values ' || '''' || password || '''' || ' default tablespace ' || default_tablespace || ' temporary tablespace ' || temporary_tablespace || ' profile ' || profile || ';' from dba_role_privs rp, dba_users u where granted_role like '&urolename' and u.username = rp.grantee and exists ( select null from dba_roles where role = rp.granted_role ) and exists ( select null from dba_users where username = rp.grantee ) / prompt prompt prompt -- grant quotas prompt prompt select 'alter user ' || q.username || ' quota ' || decode(max_bytes, -1, 'UNLIMITED', to_char( max_bytes/ 1048576 ) || 'M' ) || ' on ' || q.tablespace_name || ';' from dba_ts_quotas q, dba_role_privs rp where rp.granted_role like '&urolename' and q.username = rp.grantee order by username, tablespace_name / prompt prompt prompt -- grant roles prompt prompt select 'grant ' || granted_role || ' to ' || grantee || ';' from dba_role_privs where granted_role like '&urolename' / prompt prompt prompt -- sys privs prompt prompt select distinct 'grant ' || sp.privilege || ' to ' || sp.grantee || ';' from dba_sys_privs sp, dba_role_privs rp where rp.granted_role like '&urolename' and sp.grantee = rp.grantee order by 1 / prompt prompt prompt -- tab privs prompt prompt select 'grant ' || tp.privilege || ' on ' || tp.table_name || ' to ' || tp.grantee || ';' from dba_tab_privs tp, dba_role_privs rp where rp.granted_role like '&urolename' and tp.grantee = rp.grantee and owner = '&uowner' order by 1 / prompt prompt prompt -- all done prompt prompt prompt set echo off spool off prompt prompt run _dup_role_users.sql to create the accounts prompt @clears undef 1 2 3
SELECT * FROM Temas; SELECT * FROM Autores; SELECT * FROM Livros; SELECT * FROM Estantes;
/* 退税管理 */ delimiter $ drop trigger if exists Tgr_ExportRebatesDetail_AftereUpdate $ create trigger Tgr_ExportRebatesDetail_AftereUpdate after update on ExportRebatesDetail for each row begin /*定义变量*/ declare sInvoiceNO varchar(255); declare sOldInvoiceNO varchar(255); declare srid varchar(255); set sInvoiceNO=new.InvoiceNO; set sOldInvoiceNO=old.InvoiceNO; set srid=(Select rid From Settlements Where InvoiceNO=sInvoiceNO Limit 0,1); call Proc_Settlements_SumTaxReceived(sInvoiceNO);-- 结算中心-已退税 call Proc_Settlements_MathGrossProfit(srid);-- 结算中心-实际业务毛利 call Proc_Settlements_LastRetired(sInvoiceNO);-- 结算中心-是否已退税 set srid=(Select rid From Settlements Where InvoiceNO=sOldInvoiceNO Limit 0,1); call Proc_Settlements_SumTaxReceived(sOldInvoiceNO);-- 结算中心-已退税 call Proc_Settlements_MathGrossProfit(srid);-- 结算中心-实际业务毛利 call Proc_Settlements_LastRetired(sOldInvoiceNO);-- 结算中心-是否已退税 end$ delimiter ;
create table VPS_OCCURRENCE_STATUS ( ID integer, -- STATUS_DESC varchar(255), -- primary key (ID) );
SELECT p.`id` AS id, p.`issued` AS issued, p.`user` AS user, p.`topic` AS topic, c.`uuid` AS clientUuid, c.`name` AS clientName, c.`user` AS clientUser, c.`open` AS clientOpen, b.`uri` AS brokerUri, b.`name` AS brokerName, b.`user` AS brokerUser FROM `publishs` p INNER JOIN `clients` c ON c.`uuid` = p.`client` INNER JOIN `brokers` b ON b.`uri` = c.`broker`;
DROP TABLE articleTest ; CREATE TABLE articleTest ( idarticle NUMBER, designation VARCHAR2 (20), prixunit NUMBER (7,2), qtestock NUMBER DEFAULT 0, CONSTRAINT pk_articleTest PRIMARY KEY (idarticle) ) ; INSERT INTO articleTest VALUES (1, 'classeur', 15.7, 100) ; INSERT INTO articleTest VALUES (2, 'cahier', 4.55, 250) ; INSERT INTO articleTest VALUES (3, 'stylo', 22.7, 300) ; INSERT INTO articleTest VALUES (4, 'chemise', 3.75, 200) ; INSERT INTO articleTest VALUES (5, 'crayon', 7.8, 1000) ; COMMIT;
-- -- 우리은행가상계좌 100개를 테스트계좌로 사용하기 위해 미리 사용플래그를 '1'로 세팅 -- -- 사용안한 가상계좌가져오기 SELECT IMG_ACNT_NO FROM ( SELECT IMG_ACNT_NO FROM AUSER.ALOT_LOAN_IMG_ACNT_DESC WHERE IMG_ACNT_BANK_CD = ? AND USE_FG = '0' AND DISU_DT IS NULL ) WHERE ROWNUM = 1 ; ; select * from AUSER.ALOT_LOAN_IMG_ACNT_DESC ; select img_acnt_bank_cd, use_fg, count(*) from AUSER.ALOT_LOAN_IMG_ACNT_DESC group by img_acnt_bank_cd, use_fg; select img_acnt_bank_cd, use_fg, count(*) from AUSER.ALOT_LOAN_IMG_ACNT_DESC@hiplus_link group by img_acnt_bank_cd, use_fg; --RNUM IMG_ACNT_BANK_CD IMG_ACNT_NO -- 1 020 26665004518923 -- 8 020 26665004518999 -- 9 020 26665005118002 --100 020 26665005118912 select rownum rnum, a.* from ( select a.* from AUSER.ALOT_LOAN_IMG_ACNT_DESC a where img_acnt_bank_cd = '020' order by img_acnt_bank_cd, img_acnt_no ) a ; select * from auser.alot_loan_img_acnt_desc where img_acnt_bank_cd = '020' and img_acnt_no > '26665005118912' and use_fg = '1' ; --insert into auser.alot_loan_img_acnt_desc@hiplus_link select * from auser.alot_loan_img_acnt_desc where img_acnt_bank_cd = '020' order by img_acnt_bank_cd, img_acnt_no ; --select * from auser.alot_loan_img_acnt_desc@hiplus_link --update auser.alot_loan_img_acnt_desc@hiplus_link --set use_fg = '0' where img_acnt_bank_cd = '020' and img_acnt_no > '26665005118912' and use_fg = '1' ; --commit; --rollback; -- 리얼과 테스트 테이블 비교 select * from GUSER.GBCT_COMM_CD_DESC@hiplus_link where CD_KIND_NO = 'R00038' union select * from GUSER.GBCT_COMM_CD_DESC where CD_KIND_NO = 'R00038' ;
-- データベース内のすべての曲の名前をリストする SELECT name FROM songs;
-- TITLE1: Capture Redoscan Latency -- TITLE2:Determining Redo Log Scanning Latency for Each Capture Process -- DESC: COLUMN CAPTURE_NAME HEADING 'Capture|Process|Name' FORMAT A10 COLUMN LATENCY_SECONDS HEADING 'Latency|in|Seconds' FORMAT 999999 COLUMN LAST_STATUS HEADING 'Seconds Since|Last Status' FORMAT 999999 COLUMN CAPTURE_TIME HEADING 'Current|Process|Time' COLUMN CREATE_TIME HEADING 'Message|Creation Time' FORMAT 999999 SELECT CAPTURE_NAME, ((SYSDATE - CAPTURE_MESSAGE_CREATE_TIME)*86400) LATENCY_SECONDS, ((SYSDATE - CAPTURE_TIME)*86400) LAST_STATUS, TO_CHAR(CAPTURE_TIME, 'HH24:MI:SS MM/DD/YY') CAPTURE_TIME, TO_CHAR(CAPTURE_MESSAGE_CREATE_TIME, 'HH24:MI:SS MM/DD/YY') CREATE_TIME FROM V$STREAMS_CAPTURE;
-- Customer Table CREATE TABLE customer( customer_id SERIAL PRIMARY KEY, first_name VARCHAR(100), last_name VARCHAR(100), email VARCHAR(100), address VARCHAR(150), city VARCHAR(150), customer_state VARCHAR(10), zipcode VARCHAR(10) ); SELECT * FROM customer; -- Order Table CREATE TABLE order_( order_id SERIAL PRIMARY KEY, order_date DATE DEFAULT CURRENT_DATE, amount NUMERIC(5,2), customer_id INTEGER, FOREIGN KEY(customer_id) REFERENCES customer(customer_id) ); -- Adding presidents to our customer table INSERT INTO customer(first_name, last_name, email, address, city, customer_state, zipcode) VALUES ('George', 'Washington', 'gwash@usa.gov', '3200 Mt Vernon Hwy', 'Mt. Vernon', 'VA', '22122'), ('John', 'Adams', 'jadams@usa.gov', '1200 Hancock Rd', 'Quincy', 'MA', '02168'), ('Thomas', 'Jefferson', 'tjeff@usa.gov', '931 Thomas Jefferson Pkwy', 'Charlottesville', 'VA', '22168'), ('James', 'Madison', 'jamd@usa.gov', '11350 Independence Blvd', 'Philadelphia', 'PA', '12345'), ('James', 'Monroe', 'jmonroe@usa.gov', '224 America Rd', 'Washington', 'DC', '00001') -- Insert info INTO order table INSERT INTO order_(amount, customer_id) VALUES(234.56, 1), (75.75, 3), (123.00, 2), (67.23, 3), (50.00, NULL) -- Orders from subquery SELECT * FROM order_ WHERE customer_id IN ( SELECT customer_id FROM customer WHERE customer_state = 'VA' ); -- All 4 Joins for SQL -- INNER JOIN SELECT first_name, last_name, order_date, amount, order_.customer_id, customer.customer_id FROM customer -- TABLE 1 JOIN order_ -- TABLE 2 ON customer.customer_id = order_.customer_id; -- LEFT JOIN SELECT first_name, last_name, order_date, amount, order_.customer_id, customer.customer_id FROM customer -- TABLE 1 LEFT JOIN order_ -- TABLE 2 ON customer.customer_id = order_.customer_id; -- RIGHT JOIN SELECT first_name, last_name, order_date, amount, order_.customer_id, customer.customer_id FROM customer -- TABLE 1 RIGHT JOIN order_ -- TABLE 2 ON customer.customer_id = order_.customer_id; -- FULL JOIN SELECT first_name, last_name, order_date, amount, order_.customer_id, customer.customer_id FROM customer -- TABLE 1 FULL JOIN order_ -- TABLE 2 ON customer.customer_id = order_.customer_id; SELECT * FROM customer
-- Lisää CREATE TABLE lauseet tähän tiedostoon CREATE TABLE Kayttaja( user_id SERIAL PRIMARY KEY, username VARCHAR (20) UNIQUE NOT NULL, password VARCHAR (45) NOT NULL, bio VARCHAR (400) NOT NULL ); CREATE TABLE Kaverit( relation_id SERIAL PRIMARY KEY, lisaajaID INTEGER REFERENCES Kayttaja(user_id), lisattavaID INTEGER REFERENCES Kayttaja(user_id) ); CREATE TABLE Viesti( msg_id SERIAL PRIMARY KEY, aihe varchar (20) NOT NULL, sisalto varchar (600) NOT NULL ); CREATE TABLE KayttajanViesti( sent_id SERIAL PRIMARY KEY, viestinID INTEGER REFERENCES Viesti(msg_id), lahettajaID INTEGER REFERENCES Kayttaja(user_id), vastaanottajaID INTEGER REFERENCES Kayttaja(user_id) );
/* * Pivots the data so each day's goal is associated with * that day of the week within the date range */ SELECT * FROM ( SELECT StudentID, CONVERT(Date,DayDate) as NewDate, StartDate, EndDate, RngS, RngE, ServiceCode, ProgramDescription, EntryValue, GroupNumber, TotalDays, PtsPoss FROM ZZ_TEST_BB_20DayDataPrepared WHERE ServiceCode ='4' AND EntryValue <> '9999' ) AS SQ1 PIVOT ( MAX(EntryValue) FOR [ProgramDescription] IN (MondayGoal1,MondayGoal2,TuesdayGoal1,TuesdayGoal2,WednesdayGoal1,WednesdayGoal2,ThursdayGoal1,ThursdayGoal2,FridayGoal1,FridayGoal2) ) AS PVT
DROP TABLE IF EXISTS `help`; DROP TABLE IF EXISTS `help_category`; DROP TABLE IF EXISTS `help_category_mapping`; DROP TABLE IF EXISTS `help_tutorial`; DROP TABLE IF EXISTS `help_tutorial_user`;
DROP TABLE IF EXISTS users; CREATE TABLE users( id serial primary key, name varchar(200), email varchar(150), hash text, admin boolean DEFAULT false )
/*0725=================================== alter table cmb_maintain_period add column approvetime timestamp /*0725=================================== /*0815=================================== alter table cmb_maintain_period drop column approvetime alter table cmb_maintain_period drop column APPROVESTATUS /*0815===================================
/* * * Script responsável pela criação e configuração do sistema para uso em produção; * */ /* * criação do banco de dados do siscomerc */ create database SISCOMERC; use SISCOMERC /* * Tabelas do sistema */ /*Tipo de Usuario*/ create table TipoUsuario( codigo integer not null auto_increment, descricao varchar(25) not null, primary key(codigo) ); /*Usuario referenciando tipocreate*/ create table Usuario( codigo integer not null auto_increment, fk_tipo integer not null, nome varchar(150) not null, email varchar(80) not null, login varchar(20) not null, senha varchar(20) not null, dataCriacao datetime, ativo bit, primary key(codigo), foreign key (fk_tipo) references TipoUsuario(codigo) ); /*Estoque*/ create table Mercadoria( codigo integer not null auto_increment, codBarras integer not null, descricao varchar(80), valor double, primary key(codigo) ); /*Estoque Referenciando Mercadoria*/ create table Estoque( codigo integer not null auto_increment, fk_mercadoria integer not null, lote varchar(20) not null, quantidade integer, validade datetime not null, primary key(codigo), foreign key(fk_mercadoria) references Mercadoria(codigo) ); create table Venda( codigo integer not null auto_increment, fk_usuario integer not null, valorTotal double, dataVenda datetime, primary key(codigo), foreign key(fk_usuario) references Usuario(codigo) ); /*Tabela de apoio de venda de mercadorias para atualização no estoque*/ create table vendaMercEstoque( fk_venda integer not null, fk_mercadoria integer not null, foreign key(fk_venda) references Venda(codigo), foreign key(fk_mercadoria) references Mercadoria(codigo) ); /* * Scripts para setup do sistema no primeiro uso */ insert into Usuario (fk_tipo, nome, email, login, senha, dataCriacao, ativo) values (1,'ADMIN','admin@siscomerc.com','admin','admin',NOW(),true); /*Inserts Obrigatórios de tipos de usuário e criação do administrador */ insert into TIPO(descricao) values('ADMINISTRADOR'); insert into TIPO(descricao) values('GERENTE'); insert into TIPO(descricao) values('ESTOQUISTA'); insert into TIPO(descricao) values('CAIXA');
DECLARE v_number NUMBER := 0; BEGIN IF v_number > 0 THEN DBMS_OUTPUT.put_line ('Positive Number'); ELSIF v_number < 0 THEN DBMS_OUTPUT.put_line ('Nagetive Number'); ELSE DBMS_OUTPUT.put_line ('Equal or Zero'); END IF; END;