text
stringlengths
6
9.38M
create sequence SEQ_RATING_OPTION start with 1000 cache 20; create table RATING_OPTION ( RA_OPT_CD NUMERIC not null, LABEL VARCHAR(100) not null, LABEL_FR VARCHAR(100) not null, constraint PK_RATING_OPTION primary key (RA_OPT_CD) ); comment on column RATING_OPTION.RA_OPT_CD is 'Code'; comment on column RATING_OPTION.LABEL is 'Title'; comment on column RATING_OPTION.LABEL_FR is 'Titre'; insert into RATING_OPTION(RA_OPT_CD, LABEL, LABEL_FR) values ('1', 'One star', 'Une étoile'); insert into RATING_OPTION(RA_OPT_CD, LABEL, LABEL_FR) values ('2', 'Two stars', 'Deux étoiles'); insert into RATING_OPTION(RA_OPT_CD, LABEL, LABEL_FR) values ('3', 'Three stars', 'Trois étoiles'); insert into RATING_OPTION(RA_OPT_CD, LABEL, LABEL_FR) values ('4', 'Four stars', 'Quatre étoiles'); insert into RATING_OPTION(RA_OPT_CD, LABEL, LABEL_FR) values ('5', 'Five stars', 'Cinq étoiles');
--本数据库文档系经icare养老院项目数据库迁移而来,做了修改 EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'COMMUNITY' ; USE [master] ; ALTER DATABASE [COMMUNITY] SET SINGLE_USER WITH ROLLBACK IMMEDIATE ; USE [master] ; /****** Object: Database [COMMUNITY] Script Date: 2015/3/13 11:00:40 ******/ DROP DATABASE [COMMUNITY] ; CREATE DATABASE COMMUNITY ; USE COMMUNITY ; CREATE TABLE T_USER ( id int PRIMARY KEY IDENTITY, --用户id username nvarchar(30) NOT NULL UNIQUE, --用户登录名 name nvarchar(20) NOT NULL, --用户姓名 password varchar(64) NOT NULL, --用户密码 user_type int NOT NULL, --超级管理员=0、管理员=1,员工=2、老人=3、家属=4 user_id int NOT NULL, -- -1,gero_id, staff_id, elder_id,relative_id register_date datetime NOT NULL, --注册日期 cancel_date datetime , --注销日期 gender char(1) , --性别(男0,女1) photo_url varchar(256) , --照片url identity_no char(18) , --身份证号码 age int , --年龄 nationality nvarchar(20) , --民族 marriage int , --0:未婚 1:已婚 2:离异 3:丧偶 native_place nvarchar(20) , --籍贯 birthday date , --出生年月日 political_status nvarchar(10) , --政治面貌 education nvarchar(50) , --受教育水平 phone_no char(20) , --联系方式 zip_code char(10) , --邮编 residence_address nvarchar(50) , --户籍地址 household_address nvarchar(50) , --居住地址 email varchar(20) , --邮箱地址 wechat_id varchar(32) , --微信账号(open_id) gero_id int , --街道id,关联GERO union_id varchar(32) , --微信用户id(跨应用,见微信api) subscribe char(1) , --是否关注,取关后为0 subscribe_time datetime , --用户关注时间 CONSTRAINT uc_UserID UNIQUE (user_type,user_id) ) ; CREATE TABLE T_GERO ( id int PRIMARY KEY IDENTITY, --街道id name nvarchar(50) NOT NULL, --街道名称 city nvarchar(10) NOT NULL, --所在城市 district nvarchar(10) NOT NULL, --所在行政区 address nvarchar(30) , --所在地址 contact varchar(20) , --联系方式,座机或者手机 licence varchar(30) , --许可证 scale int , --街道人数 care_level int , --街道能提供的最高的护理等级 contact_id int , --街道联系人id,关联staff表 logo_url varchar(256) , --街道logo图片的url地址 photo_url varchar(256) , --街道封面图片的url地址 register_date datetime NOT NULL, --注册日期 cancel_date datetime , --注销日期 ) ; CREATE TABLE T_AREA ( id int PRIMARY KEY IDENTITY, --位置id parent_id int NOT NULL, --0表示逻辑上的根节点 parent_ids varchar(1000) NOT NULL, --父节点列表 gero_id int NOT NULL, --街道id,关联GERO type int , --no use level int , --no use name nvarchar(64) NOT NULL, --位置名称 full_name nvarchar(500) , --位置全名 no use del_flag char(1) NOT NULL DEFAULT '0' --默认0,删除1 ) ; CREATE TABLE T_ELDER ( id int PRIMARY KEY IDENTITY, --老人ID name nvarchar(20) NOT NULL, --老人姓名 gero_id int NOT NULL, --街道id,关联GERO nssf_id varchar(50) , --老人社保卡号 archive_id varchar(20) , --档案编号,不清楚用处,街道要求加的。 area_id int , --老人所在小区,关联T_AREA表 care_level int , --老人护理等级 checkin_date date , --入院日期 checkout_date date , --离院日期 apply_url varchar(256) , --申请表url(图片) survey_url varchar(256) , --调防表url(图片) assess_url varchar(256) , --审批表url(图片) track_url varchar(256) , --7天跟踪记录表url(图片) pad_mac varchar(17) , --老人房间pad的mac,用于绑定上传信息 ) ; CREATE TABLE T_ELDER_RELATIVE ( id int PRIMARY KEY IDENTITY, --家属ID name nvarchar(20) NOT NULL, --名字 urgent bit , --是否紧急联系人 relationship nvarchar(20) , --与老人关系,optional cancel_date datetime , --注销日期 ) ; CREATE TABLE T_ELDER_RELATIVE_RELATIONSHIP ( relative_user_id int NOT NULL, --家属user_ID elder_user_id int NOT NULL, --老人user_ID CONSTRAINT uc_Elder_Relative_Relation UNIQUE (relative_user_id,elder_user_id) ) ; CREATE TABLE T_ELDER_TEMPERATURE ( id int PRIMARY KEY IDENTITY, elder_id int NOT NULL, -- doctor_id int NOT NULL, -- temperature float NOT NULL, -- time datetime NOT NULL, -- ) CREATE TABLE T_ELDER_HEART_RATE ( id int PRIMARY KEY IDENTITY, elder_id int NOT NULL, -- doctor_id int NOT NULL, -- rate float NOT NULL, -- time datetime NOT NULL, -- ) CREATE TABLE T_ELDER_BLOOD_PRESSURE ( id int PRIMARY KEY IDENTITY, elder_id int NOT NULL, -- doctor_id int NOT NULL, -- diastolic_pressure float NOT NULL, -- systolic_pressure float NOT NULL, -- time datetime NOT NULL, -- ) CREATE TABLE T_STAFF ( id int PRIMARY KEY IDENTITY, name nvarchar(20) NOT NULL, -- nssf_id varchar(20) , --社保卡账号 gero_id int NOT NULL, --关联T_GERO表 basic_url varchar(50) , --员工基本信息表扫描件的地址 leave_date date , --离职时间 archive_id varchar(20) , --纸质档案编号 ) ; CREATE TABLE T_CARER_ITEM_RELATIONSHIP ( staff_user_id int NOT NULL, --护工的user_ID,关联staff表 care_item_id int NOT NULL, --护理项目id,关联T_CARE_ITEM CONSTRAINT uc_Carer_Item_Relation UNIQUE (staff_user_id,care_item_id) ) ; CREATE TABLE T_ORDER ( id bigint PRIMARY KEY IDENTITY, --订单表id carer_id int NOT NULL, --关联T_STAFF表 elder_id int NOT NULL, --关联T_ELDER表 care_item_id int NOT NULL, --关联T_CARE_ITEM表 item_name nvarchar(32) NOT NULL, --项目名 item_detail nvarchar(512) , --订单描述 order_type int NOT NULL, -- 0:call center status int NOT NULL, --订单状态(见后) order_time datetime , --预订时间 rate int , --评分 rate_detail nvarchar(512) , --评语 revisit_content nvarchar(512) , --回访 call_start datetime , --通话开始时间 call_end datetime , --通话结束时间 call_type int , --0:本地通话1:国内长途2:国际长途 call_detail nvarchar(512) , --通话备注 ) ; --状态: --0:开始 1:未提交 2:已提交,待确认 3.已确认 4:已派单 5:已完成未评价 --6: 已评价 7:已取消 8:已关闭(系统取消) CREATE TABLE T_ORDER_CHANGE_RECORD ( id int PRIMARY KEY IDENTITY, --订单操作记录id order_id int NOT NULL, --订单id,关联T_ORDER表 operator_id int NOT NULL, --关联T_user表 old_status int NOT NULL, --上状态 new_status int NOT NULL, --当前状态 time datetime NOT NULL, --操作时间 ) ; CREATE TABLE T_CAREWORK_RECORD ( id int PRIMARY KEY IDENTITY, carer_id int NOT NULL, --关联T_STAFF表 elder_id int NOT NULL, --关联T_ELDER表 care_item_id int NOT NULL, --关联T_CARE_ITEM表 item_name nvarchar(32) NOT NULL, --项目名 finish_time datetime NOT NULL, --完成时间 ) ; CREATE TABLE T_STAFF_SCHEDULE_PLAN ( id int PRIMARY KEY IDENTITY, staff_id int NOT NULL, -- gero_id int NOT NULL, -- work_date date NOT NULL, -- ) ; CREATE TABLE T_ROLE ( id int PRIMARY KEY IDENTITY, gero_id int NOT NULL, --关联T_GERO,如果为1,表明是系统角色,不能删除 name nvarchar(50) NOT NULL, --角色名称 notes nvarchar(32) NOT NULL, --备注 ) ; CREATE TABLE T_PRIVILEGE ( id int PRIMARY KEY IDENTITY, name nvarchar(50) NOT NULL, --权限名 parent_id int NOT NULL, --父亲结点,顶级菜单id为1,其父节点为虚拟结点,为0 parent_ids varchar(1000) NOT NULL, --所有父亲权限列表,用逗号分隔,从0开始。添加到索引 permission varchar(255) , --shiro权限字符串 api varchar(255) , --api href varchar(255) , --链接 icon varchar(100) , --图标 notes nvarchar(500) , --权限说明 ) ; CREATE TABLE T_ROLE_PRIVILEGES ( id int PRIMARY KEY IDENTITY, role_id int NOT NULL, -- privilege_id int , -- ) ; CREATE TABLE T_USER_ROLES ( id int PRIMARY KEY IDENTITY, user_id int NOT NULL, -- role_id int NOT NULL, -- ) ; CREATE TABLE T_CARE_ITEM ( id int PRIMARY KEY IDENTITY, -- gero_id int NOT NULL, --gero_id=1时为默认项目 name nvarchar(32) NOT NULL, -- icon varchar(32) , -- level int , -- period int , -- frequency int , -- start_time time(0) , -- end_time time(0) , -- notes nvarchar(32) , -- del_flag char(1) NOT NULL DEFAULT '0' --默认0,删除1 ) ; ALTER TABLE T_GERO ADD CONSTRAINT fk_GERO_staff_id FOREIGN KEY (contact_id) REFERENCES T_STAFF(id) ; ALTER TABLE T_USER ADD CONSTRAINT fk_USER_gero_id FOREIGN KEY (gero_id) REFERENCES T_GERO(id) ; ALTER TABLE T_AREA ADD CONSTRAINT fk_AREA_gero_id FOREIGN KEY (gero_id) REFERENCES T_GERO(id) ; ALTER TABLE T_ELDER ADD CONSTRAINT fk_ELDER_gero_id FOREIGN KEY (gero_id) REFERENCES T_GERO(id) ; -- ALTER TABLE T_ELDER -- ADD CONSTRAINT fk_ELDER_area_id -- FOREIGN KEY (area_id) -- REFERENCES T_AREA(id) -- ; ALTER TABLE T_ELDER_TEMPERATURE ADD CONSTRAINT fk_ELDER_TEMPERATURE_elder_id FOREIGN KEY (elder_id) REFERENCES T_ELDER(id) ; ALTER TABLE T_ELDER_TEMPERATURE ADD CONSTRAINT fk_ELDER_TEMPERATURE_doctor_id FOREIGN KEY (doctor_id) REFERENCES T_STAFF(id) ; ALTER TABLE T_ELDER_HEART_RATE ADD CONSTRAINT fk_ELDER_HEART_RATE_elder_id FOREIGN KEY (elder_id) REFERENCES T_ELDER(id) ; ALTER TABLE T_ELDER_HEART_RATE ADD CONSTRAINT fk_ELDER_HEART_RATE_doctor_id FOREIGN KEY (doctor_id) REFERENCES T_STAFF(id) ; ALTER TABLE T_ELDER_BLOOD_PRESSURE ADD CONSTRAINT fk_ELDER_BLOOD_PRESSURE_elder_id FOREIGN KEY (elder_id) REFERENCES T_ELDER(id) ; ALTER TABLE T_ELDER_BLOOD_PRESSURE ADD CONSTRAINT fk_ELDER_BLOOD_PRESSURE_doctor_id FOREIGN KEY (doctor_id) REFERENCES T_STAFF(id) ; ALTER TABLE T_STAFF ADD CONSTRAINT fk_STAFF_gero_id FOREIGN KEY (gero_id) REFERENCES T_GERO(id) ; ALTER TABLE T_STAFF_SCHEDULE_PLAN ADD CONSTRAINT fk_STAFF_SCHEDULE_PLAN_carer_id FOREIGN KEY (staff_id) REFERENCES T_STAFF(id) ; ALTER TABLE T_STAFF_SCHEDULE_PLAN ADD CONSTRAINT fk_STAFF_SCHEDULE_PLAN_gero_id FOREIGN KEY (gero_id) REFERENCES T_GERO(id) ; ALTER TABLE T_ROLE ADD CONSTRAINT fk_ROLE_gero_id FOREIGN KEY (gero_id) REFERENCES T_GERO(id) ; ALTER TABLE T_ROLE_PRIVILEGES ADD CONSTRAINT fk_ROLE_PRIVILEGES_role_id FOREIGN KEY (role_id) REFERENCES T_ROLE(id) ON DELETE CASCADE ; ALTER TABLE T_ROLE_PRIVILEGES ADD CONSTRAINT fk_ROLE_PRIVILEGES_privilege_id FOREIGN KEY (privilege_id) REFERENCES T_PRIVILEGE(id) ON DELETE CASCADE ; ALTER TABLE T_USER_ROLES ADD CONSTRAINT fk_USER_ROLES_staff_id FOREIGN KEY (user_id) REFERENCES T_USER(id) ON DELETE CASCADE ; ALTER TABLE T_USER_ROLES ADD CONSTRAINT fk_USER_ROLES_role_id FOREIGN KEY (role_id) REFERENCES T_ROLE(id) ON DELETE CASCADE ; ALTER TABLE T_CARE_ITEM ADD CONSTRAINT fk_CARE_ITEM_gero_id FOREIGN KEY (gero_id) REFERENCES T_GERO(id) ;
CREATE TABLE kh01( irum VARCHAR2(100), addr VARCHAR2(500) ) INSERT INTO kh01(irum,addr) values('정보교육원','서울특별시영등포구당산') SELECT irum,addr FROM kh01
CREATE TABLE `users` ( `id` VARCHAR(50) NOT NULL, `username` VARCHAR(30) NOT NULL, `email` VARCHAR(30) NOT NULL, `password` VARCHAR(100) NOT NULL, `firstname` VARCHAR(30) DEFAULT NULL, `surname` VARCHAR(30) DEFAULT NULL, `picture` VARCHAR(30) DEFAULT NULL, `acc_type` VARCHAR(30) NOT NULL, `create_at` VARCHAR(30) NOT NULL, `update_at` VARCHAR(30) NOT NULL, `active` VARCHAR(30) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
--DATA ENGINEERING-- -- Exported from QuickDBD: https://www.quickdatabasediagrams.com/ CREATE TABLE "departments" ("dept_no" VARCHAR NOT NULL, "dept_name" VARCHAR NOT NULL, CONSTRAINT "pk_departments" PRIMARY KEY ("dept_no") ); CREATE TABLE "dept_emp" ("emp_no" INT NOT NULL, "dept_no" VARCHAR NOT NULL, CONSTRAINT "pk_dept_emp" PRIMARY KEY("emp_no" , "dept_no") ); CREATE TABLE "dept_manager" ("dept_no" VARCHAR NOT NULL, "emp_no" INT NOT NULL, CONSTRAINT "pk_dept_manager" PRIMARY KEY ("dept_no", "emp_no") ); CREATE TABLE "employees" ("emp_no" INT NOT NULL, "emp_title_id" VARCHAR NOT NULL, "birth_date" DATE NOT NULL, "first_name" VARCHAR NOT NULL, "last_name" VARCHAR NOT NULL, "sex" VARCHAR NOT NULL, "hire_date" DATE NOT NULL, CONSTRAINT "pk_employees" PRIMARY KEY ("emp_no") ); CREATE TABLE "salaries" ("emp_no" INT NOT NULL, "salary" INT NOT NULL, CONSTRAINT "pk_salaries" PRIMARY KEY ("emp_no") ); CREATE TABLE "titles" ("title_id" VARCHAR NOT NULL , "title" VARCHAR NOT NULL, CONSTRAINT "pk_titles" PRIMARY KEY ("title_id") ); ALTER TABLE "dept_emp" ADD CONSTRAINT "fk_dept_emp_emp_no" FOREIGN KEY("emp_no") REFERENCES "employees" ("emp_no"); ALTER TABLE "dept_emp" ADD CONSTRAINT "fk_dept_emp_dept_no" FOREIGN KEY("dept_no") REFERENCES "departments" ("dept_no"); ALTER TABLE "dept_manager" ADD CONSTRAINT "fk_dept_manager_dept_no" FOREIGN KEY("dept_no") REFERENCES "departments" ("dept_no"); ALTER TABLE "dept_manager" ADD CONSTRAINT "fk_dept_manager_emp_no" FOREIGN KEY("emp_no") REFERENCES "employees" ("emp_no"); ALTER TABLE "salaries" ADD CONSTRAINT "fk_salaries_emp_no" FOREIGN KEY("emp_no") REFERENCES "employees" ("emp_no"); ALTER TABLE "employees" ADD CONSTRAINT "fk_employees_emp_title_id" FOREIGN KEY("emp_title_id") REFERENCES "titles" ("title_id"); --Query -- Selecting * from each table to confirm data select * from departments; select * from dept_emp; select * from dept_manager; select * from employees; select * from salaries; select * from titles; select count(*) from departments; select count(*) from dept_emp; select count(*) from dept_manager; select count(*) from employees; select count(*) from salaries; select count(*) from titles; -- Data Analysis -- 1. List the following details of each employee: employee number, last name, first name, sex, and salary. select employees.emp_no, employees.last_name, employees.first_name, employees.sex, salaries.salary from employees join salaries on employees.emp_no = salaries.emp_no; -- 2. List first name, last name, and hire date for employees who were hired in 1986. select first_name, last_name, hire_date from employees where hire_date >= '1986-01-01' and hire_date <= '1986-12-31'; -- 3. List the manager of each department with the following information: department number, department name, the manager's employee number, last name, first name. select departments.dept_no, departments.dept_name, dept_manager.emp_no, employees.last_name, employees.first_name from departments join dept_manager on departments.dept_no = dept_manager.dept_no join employees on dept_manager.emp_no = employees.emp_no; -- 4. List the department of each employee with the following information: employee number, last name, first name, and department name. select dept_emp.emp_no, employees.last_name, employees.first_name, departments.dept_name from dept_emp join employees on dept_emp.emp_no = employees.emp_no join departments on dept_emp.dept_no = departments.dept_no; -- 5. List first name, last name, and sex for employees whose first name is "Hercules" and last names begin with "B." select first_name, last_name, sex from employees where first_name = 'Hercules' and last_name like 'B%'; -- 6. List all employees in the Sales department, including their employee number, last name, first name, and department name. select dept_emp.emp_no, employees.last_name, employees.first_name, departments.dept_name from dept_emp join employees on dept_emp.emp_no = employees.emp_no join departments on dept_emp.dept_no = departments.dept_no where departments.dept_name = 'Sales' -- 7. List all employees in the Sales and Development departments, including their employee number, last name, first name, and department name. select dept_emp.emp_no, employees.last_name, employees.first_name, departments.dept_name from dept_emp join employees on dept_emp.emp_no = employees.emp_no join departments on dept_emp.dept_no = departments.dept_no where departments.dept_name = 'Sales' or departments.dept_name = 'Development'; -- 8. In descending order, list the frequency count of employee last names, i.e., how many employees share each last name. select last_name, count(last_name) as "frequency" from employees group by last_name order by "frequency" desc; ------Bonus----------
set linesi 100 trimspool on col grantee format a15 col privilege format a30 col priv_type format a10 select grantee, granted_role, 'ROLE' priv_type from dba_role_privs where granted_role='&1';
--1. 부서 테이블과 사원테이블에서 사번, 사원명, 부서코드, 부서명을 검색하시오. (사원명 오름차순) SELECT E.EMPNO, E.ENAME, D.DEPTNO, D.DNAME FROM EMP E, DEPT D WHERE E.DEPTNO = D.DEPTNO ORDER BY E.ENAME ASC; --2. 부서테이블과 사원테이블에서 사번, 사원명, 급여, 부셔명을 검색. 단, 급여가 2000 이상인 사원에 대하여 급여기준으로 내림차순 정렬 SELECT E.EMPNO, E.ENAME, E.SAL, D.DNAME FROM EMP E, DEPT D WHERE E.DEPTNO = D.DEPTNO AND SAL >= 2000 ORDER BY E.SAL DESC; --3. 부서테이블과 사원테이블에서 사번, 사원명, 업무, 급여, 부서명을 검색. 단, 업무가 MANAGER이며 급여가 2500 이상인 사원에 대하여 -- 사번을 기준으로 오름차순 정렬 SELECT E.EMPNO, E.ENAME, E.JOB, E.SAL, D.DNAME FROM EMP E, DEPT D WHERE E.DEPTNO = D.DEPTNO AND JOB = 'MANAGER' AND SAL >= 2500 ORDER BY E.EMPNO ASC; --4. 사원테이블과 급여 등급 테이블에서 사번, 사원명, 급여, 등급을 검색. 단, 등급은 급여가 하한값과 상한값 범위에 포함되고 등급이 4이며 -- 급여를 기준으로 내림차순 정렬 SELECT D.DEPTNO, D.DNAME, E.SAL, G.GRADE FROM DEPT D, EMP E, SALGRADE G WHERE E.DEPTNO = D.DEPTNO AND (E.SAL >= G.LOSAL AND E.SAL <= G.HISAL) AND G.GRADE = 4 ORDER BY E.SAL DESC; --5. 부서테이블, 사원테이블 급여등급 테이블에서 사번, 사원명, 부서명, 급여, 등급을 검색. 단, 등급은 급여가 하한값과 상한값 범위에 --포함되며 등급을 기준으로 내림차순 정렬 SELECT D.DEPTNO, D.DNAME, E.ENAME, E.SAL, G.GRADE FROM DEPT D, EMP E, SALGRADE G WHERE E.DEPTNO = D.DEPTNO AND (E.SAL >= G.LOSAL AND E.SAL <= G.HISAL) ORDER BY G.GRADE DESC;
\encoding UTF8; SET client_min_messages TO WARNING; CREATE TABLE app.gen_contatore ( id serial NOT NULL PRIMARY KEY, codice VARCHAR(50) NOT NULL, descrizione VARCHAR(255), contatore INTEGER NOT NULL DEFAULT 1 );
■問題 アンケート回答テーブル(quest)から回答日付が新しい物を先頭から10件取り出してみましょう。 取得列は、name, answer1, answer2列とします。以下の空欄を埋めてSQL命令を完成させてください。 SELECT name, answer1, answer2 FROM quest ORDER BY [①空欄] LIMIT [②空欄],10 ; ■実行文 # name, answer1, answer2列を取得 SELECT name, answer1, answer2 # アンケート回答テーブルから取得 FROM quest # 回答日付が新しい順に並べる ORDER BY answered DESC # 取得する行は先頭から10件 LIMIT 0, 10 ; ■返却値 mysql> # name, answer1, answer2列を取得 mysql> SELECT -> name, -> answer1, -> answer2 -> # アンケート回答テーブルから取得 -> FROM -> quest -> # 回答日付が新しい順に並べる -> ORDER BY -> answered DESC -> # 取得する行は先頭から10件 -> LIMIT -> 0, 10 -> ; +------------+---------+------------------+ | name | answer1 | answer2 | +------------+---------+------------------+ | 根岸亜由美 | 3 | 絵がかわいい。 | | 西島泰治 | 3 | 読みやすいです。 | | 森本雄二 | 1 | NULL | | 村井聡 | 3 | 文字が小さい。 | | 南幸一 | 2 | | | 清水一郎 | 2 | NULL | | 和田駿 | 1 | NULL | | 吉岡毅 | 3 | NULL | | 有木守 | 3 | 買ってよかった。 | | 矢口一樹 | 2 | NULL | +------------+---------+------------------+ 10 rows in set (0.00 sec)
-- Sequence: notification_id_seq -- DROP SEQUENCE notification_id_seq; CREATE SEQUENCE notification_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; ALTER TABLE notification_id_seq OWNER TO web; -- Table: notification -- DROP TABLE notification; CREATE TABLE notification ( id bigint NOT NULL DEFAULT nextval('notification_id_seq'::regclass), user_id bigint NOT NULL, date timestamp without time zone NOT NULL, is_new boolean NOT NULL DEFAULT true, text text, type character varying(64), is_shown boolean NOT NULL DEFAULT false, CONSTRAINT notification_pkey PRIMARY KEY (id), CONSTRAINT notification_user_id FOREIGN KEY (user_id) REFERENCES users (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS=FALSE ); ALTER TABLE notification OWNER TO web;
create index hakukohteet_hakuoid_idx on hakukohteet using btree (haku_oid);
/* Navicat MySQL Data Transfer Source Server : 5kcrm Source Server Version : 50505 Source Host : localhost:3306 Source Database : eth Target Server Type : MYSQL Target Server Version : 50505 File Encoding : 65001 Date: 2018-06-02 13:45:15 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `tradelist` -- ---------------------------- DROP TABLE IF EXISTS `tradelist`; CREATE TABLE `tradelist` ( `id` int(8) NOT NULL AUTO_INCREMENT COMMENT 'id', `txHash` varchar(70) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '交易哈希', `blockHeight` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '高度', `amount` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '金额变化数量', `originatorAdress` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '发送方地址', `recevierAdress` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '接受者地址', `confirmTime` datetime DEFAULT NULL COMMENT '确认时间', `brokerage` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '矿工费', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- ---------------------------- -- Records of tradelist -- ----------------------------
alter table indigo.users rename column firtname to firstname;
-- MySQL Script generated by MySQL Workbench -- 01/20/20 20:08:42 -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema SIM_Registaration -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema SIM_Registaration -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `SIM_Registaration` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; USE `SIM_Registaration` ; -- ----------------------------------------------------- -- Table `SIM_Registaration`.`User` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `SIM_Registaration`.`User` ( `UserID` INT NOT NULL AUTO_INCREMENT COMMENT '', `UserName` VARCHAR(45) NULL COMMENT '', `Password` VARCHAR(45) NULL COMMENT '', `Forgot Password` VARCHAR(45) NULL COMMENT '', `FirstName` VARCHAR(45) NULL COMMENT '', `LastName` VARCHAR(45) NULL COMMENT '', `Address` VARCHAR(200) NULL COMMENT '', `NICnumber` VARCHAR(15) NULL COMMENT '', `Contact Number` VARCHAR(15) NULL COMMENT '', `Usercol` VARCHAR(45) NULL COMMENT '', PRIMARY KEY (`UserID`) COMMENT '') ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `SIM_Registaration`.`SIM` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `SIM_Registaration`.`SIM` ( `SIM Id` INT NOT NULL AUTO_INCREMENT COMMENT '', `SIM Number` INT NULL COMMENT '', `NIC Image` VARCHAR(45) NULL COMMENT '', `First Name` MEDIUMBLOB NULL COMMENT '', `Last Name` VARCHAR(45) NULL COMMENT '', `NIC Number` INT NULL COMMENT '', `Address` VARCHAR(45) NULL COMMENT '', `Gender` VARCHAR(45) NULL COMMENT '', `SIM Category` VARCHAR(45) NULL COMMENT '', PRIMARY KEY (`SIM Id`) COMMENT '') ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
CREATE TABLE JOEL( "policyID" INTEGER, "statecode" CHAR, "county" CHAR, "eq_site_limit" CHAR, "hu_site_limit" INTEGER, "fl_site_limit" INTEGER, "fr_site_limit" INTEGER, "tiv_2011" INTEGER, "tiv_2012" INTEGER, "eq_site_deductible" REAL, "hu_site_deductible" INTEGER, "fl_site_deductible" REAL, "fr_site_deductible" INTEGER, "point_latitude" INTEGER, "point_longitude" REAL, "line" REAL, "construction" CHAR, "point_granularity" CHAR ); .mode csv .import FL_insurance_sample.csv JOEL SELECT*FROM JOEL LIMIT 10; SELECT County, COUNT(*) FROM JOEL GROUP BY County; SELECT AVG(tiv_2012-tiv_2011) FROM JOEL; SELECT Construction, COUNT(*) FROM JOEL GROUP BY Construction;
CREATE DATABASE IF NOT EXISTS `laravel` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE `admins` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE IF NOT EXISTS `article` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '文章标题', `abstract` VARCHAR(128) NOT NULL DEFAULT '' COMMENT '简介', `banner_img` VARCHAR(256) NOT NULL DEFAULT '' COMMENT '文章首页展示的图片', `content` text NOT NULL DEFAULT '' COMMENT '文章内容', `article_type_id` INT(11) NOT NULL DEFAULT '1' COMMENT '文章主题', `article_column_id` INT(11) NOT NULL DEFAULT '1' COMMENT '文章栏目', `thumbs_up` INT(11) NOT NULL DEFAULT '0' COMMENT '文章点赞数', `favorite` INT(11) NOT NULL DEFAULT '0' COMMENT '文章收藏数', `created_at` INT (11) NULL DEFAULT '0', `updated_at` INT (11) NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_article_type_id` (`article_type_id`), KEY `idx_article_column_id` (`article_column_id`), KEY `idx_title` (`title`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '文章表'; alter table article add status SMALLINT(3) NOT NULL DEFAULT '0' COMMENT '文章状态,0-未发布 1-已发布'; CREATE TABLE IF NOT EXISTS `article_type` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '主题名称', PRIMARY KEY (`id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '文章主题表'; CREATE TABLE IF NOT EXISTS `article_column` ( `id` INT (11) NOT NULL AUTO_INCREMENT, `article_type_id` INT (11) NOT NULL DEFAULT '1' COMMENT '文章主题id', `name` VARCHAR (64) NOT NULL DEFAULT '' COMMENT '栏目名称', PRIMARY KEY (`id`), KEY `idx_article_type_id` (`article_type_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '文章栏目表'; CREATE TABLE IF NOT EXISTS `favorite` ( `id` INT (11) NOT NULL AUTO_INCREMENT, `article_id` INT (11) NOT NULL DEFAULT '1' COMMENT '文章id', `user_id` INT (11) NOT NULL DEFAULT '1' COMMENT '用户id', `created_at` INT (11) NULL DEFAULT '0', `updated_at` INT (11) NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_article_id` (`article_id`), KEY `idx_user_id` (`user_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '收藏表'; CREATE TABLE IF NOT EXISTS `thumbs_up` ( `id` INT (11) NOT NULL AUTO_INCREMENT, `article_id` INT (11) NOT NULL DEFAULT '1' COMMENT '文章id', `user_id` INT (11) NOT NULL DEFAULT '1' COMMENT '用户id', `created_at` INT (11) NULL DEFAULT '0', `updated_at` INT (11) NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_article_id` (`article_id`), KEY `idx_user_id` (`user_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '点赞表'; CREATE TABLE IF NOT EXISTS `follow` ( `id` INT (11) NOT NULL AUTO_INCREMENT, `article_column_id` INT (11) NOT NULL DEFAULT '1' COMMENT '文章id', `user_id` INT (11) NOT NULL DEFAULT '1' COMMENT '用户id', `created_at` INT (11) NULL DEFAULT '0', `updated_at` INT (11) NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_article_column_id` (`article_column_id`), KEY `idx_user_id` (`user_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '关注表'; INSERT INTO article_type(`name`) VALUES ('软件使用'), VALUES ('摄影技巧'), VALUES ('智能设备'), VALUES ('生活方式'); INSERT INTO article_column(`id`,`name`) VALUES (1,'IOS'), VALUES (1,'Android'), VALUES (1,'Mac'), VALUES (1,'Win'), VALUES (2,'手机拍照'), VALUES (2,'相机拍照'), VALUES (2,'修图技巧'), VALUES (3,'手机测评'), VALUES (3,'影音器材'), VALUES (3,'数码周边'), VALUES (4,'游戏'), VALUES (4,'电影'), VALUES (4,'音乐'), VALUES (4,'家装');
CREATE TABLE IF NOT EXISTS public.people ( id SERIAL, "name" varchar(255) NOT NULL, password varchar(32) NOT NULL, avatar_seed integer NOT NULL ); CREATE UNIQUE INDEX IF NOT EXISTS people_name_idx ON public.people ("name"); CREATE TABLE IF NOT EXISTS public.messages ( id SERIAL, content varchar(1024) NOT NULL, author_id integer NOT NULL, datetime timestamp NOT NULL ); CREATE UNIQUE INDEX IF NOT EXISTS messages_datetime_id_idx ON public.messages ("datetime", "id");
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 13, 2021 at 05:15 PM -- Server version: 10.4.17-MariaDB -- PHP Version: 8.0.2 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `lara-vue` -- -- -------------------------------------------------------- -- -- Table structure for table `failed_jobs` -- CREATE TABLE `failed_jobs` ( `id` bigint(20) UNSIGNED NOT NULL, `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, `failed_at` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `menus` -- CREATE TABLE `menus` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` varchar(255) NOT NULL, `restaurant_id` varchar(255) NOT NULL, `menu_name` varchar(255) NOT NULL, `menu_img` varchar(255) NOT NULL, `menu_detail` varchar(255) NOT NULL, `menu_status` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `menus` -- INSERT INTO `menus` (`id`, `user_id`, `restaurant_id`, `menu_name`, `menu_img`, `menu_detail`, `menu_status`, `created_at`, `updated_at`) VALUES (1, '1', '1', 'กระเพราหมูสับ ไข่ดาว', 'https://cdn.pixabay.com/photo/2016/07/20/00/49/thailand-food-1529442_960_720.jpg', 'test', '', '2021-05-07 16:27:24', NULL), (2, '1', '1', 'กระเพราหมูสับ ไข่ดาว', 'https://cdn.pixabay.com/photo/2016/07/20/00/49/thailand-food-1529442_960_720.jpg', 'test', '', '2021-05-07 16:27:24', NULL), (4, '1', '1', 'Pizzaa', 'https://cdn.pixabay.com/photo/2017/12/09/08/18/pizza-3007395_960_720.jpg', '1', '0', '2021-05-09 13:09:20', '2021-05-09 06:09:20'); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2014_10_12_000000_create_users_table', 1), (2, '2014_10_12_100000_create_password_resets_table', 1), (3, '2019_08_19_000000_create_failed_jobs_table', 1), (4, '2021_05_05_131316_create_products_table', 1), (5, '2021_05_07_160532_create_menus_table', 2), (6, '2021_05_09_102146_create_orders_table', 3); -- -------------------------------------------------------- -- -- Table structure for table `orders` -- CREATE TABLE `orders` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` varchar(255) NOT NULL, `menu_id` varchar(255) NOT NULL, `orders_detail` varchar(255) NOT NULL, `orders_status` varchar(255) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `password_resets` -- CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `products` -- CREATE TABLE `products` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `detail` text COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `products` -- INSERT INTO `products` (`id`, `name`, `detail`, `created_at`, `updated_at`) VALUES (1, 'test1 11', 'test tset', '2021-05-05 15:31:11', '2021-05-05 08:31:11'), (2, 'test2', 'test tset test', '2021-05-05 08:30:57', '2021-05-05 08:30:57'), (3, 'test2222', 'test tset test', '2021-05-05 08:30:57', '2021-05-05 08:30:57'), (4, 'test', 'test testt tsett', '2021-05-08 09:15:50', '2021-05-08 09:15:50'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Indexes for dumped tables -- -- -- Indexes for table `failed_jobs` -- ALTER TABLE `failed_jobs` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`); -- -- Indexes for table `menus` -- ALTER TABLE `menus` ADD PRIMARY KEY (`id`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `orders` -- ALTER TABLE `orders` ADD PRIMARY KEY (`id`); -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` ADD KEY `password_resets_email_index` (`email`); -- -- Indexes for table `products` -- ALTER TABLE `products` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `users_email_unique` (`email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `failed_jobs` -- ALTER TABLE `failed_jobs` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `menus` -- ALTER TABLE `menus` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `orders` -- ALTER TABLE `orders` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `products` -- ALTER TABLE `products` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump -- version 4.9.0.1 -- https://www.phpmyadmin.net/ -- -- Servidor: 127.0.0.1 -- Tiempo de generación: 15-11-2020 a las 07:31:06 -- Versión del servidor: 10.3.16-MariaDB -- Versión de PHP: 7.3.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de datos: `inventariobd` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cliente` -- CREATE TABLE `cliente` ( `ced_cliente` varchar(9) NOT NULL, `nom_cliente` varchar(20) NOT NULL, `ape_cliente` varchar(20) NOT NULL, `tlf_cliente` varchar(14) NOT NULL, `correo_cliente` varchar(40) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `detalle_compra` -- CREATE TABLE `detalle_compra` ( `nro_fact_compra` varchar(12) NOT NULL, `cod_producto` varchar(10) NOT NULL, `cantidad_producto` int(11) NOT NULL, `total` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `detalle_venta` -- CREATE TABLE `detalle_venta` ( `nro_fact_venta` varchar(12) NOT NULL, `cod_producto` varchar(10) NOT NULL, `cantidad_producto` int(11) NOT NULL, `total` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `factura_compra` -- CREATE TABLE `factura_compra` ( `nro_fact_compra` varchar(12) NOT NULL, `rif_prov` varchar(11) NOT NULL, `fecha_factura_c` date NOT NULL, `cod_pagoc` varchar(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `factura_venta` -- CREATE TABLE `factura_venta` ( `nro_fact_venta` varchar(12) NOT NULL, `ced_cliente` varchar(9) NOT NULL, `fecha_factura_v` date NOT NULL, `cod_pagov` varchar(3) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `pago_compra` -- CREATE TABLE `pago_compra` ( `cod_pagoc` varchar(3) NOT NULL, `tipoPagoC` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `pago_venta` -- CREATE TABLE `pago_venta` ( `cod_pagov` varchar(3) NOT NULL, `tipoPagoV` varchar(20) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `producto` -- CREATE TABLE `producto` ( `cod_producto` varchar(10) NOT NULL, `nom_producto` varchar(40) NOT NULL, `marca_producto` varchar(20) DEFAULT NULL, `precio` int(11) NOT NULL, `costo` int(11) NOT NULL, `existencia_inv` int(11) NOT NULL, `stock_max` int(11) NOT NULL, `stock_min` int(11) NOT NULL, `aplicacion_vehiculo` varchar(150) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `proveedor` -- CREATE TABLE `proveedor` ( `rif_prov` varchar(11) NOT NULL, `razon_social` varchar(30) NOT NULL, `tlf_prov` varchar(14) NOT NULL, `correo_prov` varchar(40) NOT NULL, `direccion_prov` varchar(40) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `usuario` -- CREATE TABLE `usuario` ( `ced_usuario` varchar(9) NOT NULL, `nom_usuario` varchar(10) NOT NULL, `nom_real_usuario` varchar(20) NOT NULL, `ape_usuario` varchar(20) NOT NULL, `clave_usuario` varchar(10) NOT NULL, `rol_usuario` varchar(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Índices para tablas volcadas -- -- -- Indices de la tabla `cliente` -- ALTER TABLE `cliente` ADD PRIMARY KEY (`ced_cliente`), ADD UNIQUE KEY `ced_cliente` (`ced_cliente`); -- -- Indices de la tabla `detalle_compra` -- ALTER TABLE `detalle_compra` ADD KEY `detallecompra-factura` (`nro_fact_compra`), ADD KEY `detallecompra-producto` (`cod_producto`); -- -- Indices de la tabla `detalle_venta` -- ALTER TABLE `detalle_venta` ADD KEY `detalleventa-factura` (`nro_fact_venta`), ADD KEY `detalleventa-producto` (`cod_producto`); -- -- Indices de la tabla `factura_compra` -- ALTER TABLE `factura_compra` ADD PRIMARY KEY (`nro_fact_compra`), ADD KEY `fact_compra_proveedor` (`rif_prov`), ADD KEY `pago-compra` (`cod_pagoc`); -- -- Indices de la tabla `factura_venta` -- ALTER TABLE `factura_venta` ADD PRIMARY KEY (`nro_fact_venta`), ADD KEY `fact_venta_cliente` (`ced_cliente`), ADD KEY `pago-venta` (`cod_pagov`); -- -- Indices de la tabla `pago_compra` -- ALTER TABLE `pago_compra` ADD PRIMARY KEY (`cod_pagoc`); -- -- Indices de la tabla `pago_venta` -- ALTER TABLE `pago_venta` ADD PRIMARY KEY (`cod_pagov`); -- -- Indices de la tabla `producto` -- ALTER TABLE `producto` ADD PRIMARY KEY (`cod_producto`), ADD UNIQUE KEY `cod_producto` (`cod_producto`); -- -- Indices de la tabla `proveedor` -- ALTER TABLE `proveedor` ADD PRIMARY KEY (`rif_prov`), ADD UNIQUE KEY `rif_prov` (`rif_prov`); -- -- Indices de la tabla `usuario` -- ALTER TABLE `usuario` ADD PRIMARY KEY (`ced_usuario`), ADD UNIQUE KEY `ced_usuario` (`ced_usuario`); -- -- Restricciones para tablas volcadas -- -- -- Filtros para la tabla `detalle_compra` -- ALTER TABLE `detalle_compra` ADD CONSTRAINT `detallecompra-factura` FOREIGN KEY (`nro_fact_compra`) REFERENCES `factura_compra` (`nro_fact_compra`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `detallecompra-producto` FOREIGN KEY (`cod_producto`) REFERENCES `producto` (`cod_producto`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `detalle_venta` -- ALTER TABLE `detalle_venta` ADD CONSTRAINT `detalleventa-factura` FOREIGN KEY (`nro_fact_venta`) REFERENCES `factura_venta` (`nro_fact_venta`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `detalleventa-producto` FOREIGN KEY (`cod_producto`) REFERENCES `producto` (`cod_producto`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `factura_compra` -- ALTER TABLE `factura_compra` ADD CONSTRAINT `fact_compra_proveedor` FOREIGN KEY (`rif_prov`) REFERENCES `proveedor` (`rif_prov`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `pago-compra` FOREIGN KEY (`cod_pagoc`) REFERENCES `pago_compra` (`cod_pagoc`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Filtros para la tabla `factura_venta` -- ALTER TABLE `factura_venta` ADD CONSTRAINT `fact_venta_cliente` FOREIGN KEY (`ced_cliente`) REFERENCES `cliente` (`ced_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `pago-venta` FOREIGN KEY (`cod_pagov`) REFERENCES `pago_venta` (`cod_pagov`) ON DELETE CASCADE ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
--分页查询 create or replace procedure queryPagenation(tableName in varchar2, pageIndex in number, pageSize in number, totalCount out number, totalPage out number, resultCur out cmn.mCursor) is mStart number(5); mEnd number(5); mSql varchar2(2000); begin --查询记录数,在Sql字符串中(动态执行),不能写 into语句 只能写一般的Sql语句 mSql := 'select count(*) from ' || tableName; execute immediate mSql into totalCount; --计算总页数 totalPage := totalCount / pageSize; if mod(totalCount, pageSize) <> 0 then totalPage := totalPage + 1; end if; --计算Start和End mStart := pageSize * (pageIndex - 1) + 1; mEnd := pageSize * pageIndex + 1; --查询数据,开启游标返回结果集 mSql := 'select * from (select t.*, rownum rn from (select * from ' || tableName || ') t where rownum <= ' || mEnd || ') where rn >= ' || mStart; open resultCur for mSql; end queryPagenation; -----------------定义包 create or replace package cmn is -- Author : ZHANGBING -- Created : 2014/11/15 17:10:16 -- Purpose : 公共函数和类型 -- Public type declarations type mCursor is ref cursor; --游标类型 -- Public constant declarations versionCode constant varchar2(10) := '1.0.1'; --版本号 end cmn;
/* Local administration application */ INSERT INTO resourceserver (id, contactEmail, contactName, resourceServerName, resourceServerKey, secret, owner, thumbNailUrl) VALUES (99998, 'localadmin@example.com','local admin','Authorization Server Apis', 'authorization-server-admin', 'cafebabe-cafe-babe-cafe-babecafebabe', null, 'https://raw.github.com/OpenConextApps/apis/master/apis-images/surf-oauth.png'); INSERT INTO ResourceServer_scopes values (99998, 'read'),(99998, 'write') ; INSERT INTO client (id, contactEmail, contactName, description, clientName, thumbNailUrl, resourceserver_id, clientId, includePrincipal, allowedImplicitGrant) VALUES (99998, 'client@coolapp.com', 'john.doe', 'Javascript application for authorization server administration', 'Authorization Server Admin Client', 'https://raw.github.com/OpenConextApps/apis/master/apis-images/surf-oauth-client.png', 99998, 'authorization-server-admin-js-client', 1, 1); INSERT INTO Client_scopes values (99998, 'read'), (99998, 'write'); /* Client for user password credentials */ INSERT INTO resourceserver (id, contactEmail, contactName, resourceServerName, resourceServerKey, secret, owner, thumbNailUrl) VALUES (99999, 'oauth@dewan.com','local admin','Dewan Authorization Server', 'authorization-server-admin', 'cafebabe-cafe-babe-cafe-babecafebabe', null, 'https://raw.github.com/OpenConextApps/apis/master/apis-images/surf-oauth.png'); INSERT INTO ResourceServer_scopes values (99999, 'read'),(99999, 'write') ; INSERT INTO client (id, contactEmail, contactName, description, clientName, thumbNailUrl, resourceserver_id, clientId, secret, expireDuration, useRefreshTokens, allowedUserPasswordCredentials) VALUES (99999, 'oauth@dewan.com', 'oauth.dewan', 'Web application for authorization', 'Dewan Oauth client', 'thumbnailurl', 99999, 'dewan-oauth-client', 'c2FsYW0ta2V5OnNhbGFtLX', 36000, 1, 1); INSERT INTO Client_scopes values (99999, 'read'),(99999, 'write');
REATE TABLE CURRENCY( ID VARCHAR(255) NOT NULL, CURRENCY_TYPE INTEGER, FULL_NAME VARCHAR(255), NOMINAL INTEGER, VALUE DECIMAL(19,2), --- PRIMARY KEY (ID) );
-- phpMyAdmin SQL Dump -- version 4.9.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 26, 2020 at 06:39 AM -- Server version: 10.4.8-MariaDB -- PHP Version: 7.3.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `dbms` -- -- -------------------------------------------------------- -- -- Table structure for table `absentdates` -- CREATE TABLE `absentdates` ( `courseid` varchar(30) NOT NULL, `studentrollno` varchar(30) NOT NULL, `absentdates` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `username` varchar(30) NOT NULL, `password` varchar(30) NOT NULL, `ID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`username`, `password`, `ID`) VALUES ('admin', 'admin', 1); -- -------------------------------------------------------- -- -- Table structure for table `attendance` -- CREATE TABLE `attendance` ( `courseid` varchar(30) NOT NULL, `srollno` varchar(30) NOT NULL, `noofhourspresent` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `course` -- CREATE TABLE `course` ( `cname` varchar(30) NOT NULL, `cid` varchar(30) NOT NULL, `departmentid` int(11) NOT NULL, `facultyid` int(11) NOT NULL, `totalhourstaken` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `course` -- INSERT INTO `course` (`cname`, `cid`, `departmentid`, `facultyid`, `totalhourstaken`) VALUES ('DBMS', '1', 1, 0, 0), ('DSA', '2', 1, 0, 0), ('OS', '3', 1, 0, 0), ('DSA', 'CS1', 1, 0, 0); -- -------------------------------------------------------- -- -- Table structure for table `department` -- CREATE TABLE `department` ( `dname` varchar(30) NOT NULL, `did` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `department` -- INSERT INTO `department` (`dname`, `did`) VALUES ('CSE', 1); -- -------------------------------------------------------- -- -- Table structure for table `faculty` -- CREATE TABLE `faculty` ( `fname` varchar(30) NOT NULL, `fid` int(11) NOT NULL, `departmentid` int(11) NOT NULL, `fusername` varchar(30) NOT NULL, `fpassword` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `faculty` -- INSERT INTO `faculty` (`fname`, `fid`, `departmentid`, `fusername`, `fpassword`) VALUES ('Abdul Nazeer', 3, 1, 'Nazeer', 'Nazeer'); -- -------------------------------------------------------- -- -- Table structure for table `student` -- CREATE TABLE `student` ( `sname` varchar(30) NOT NULL, `departmentid` int(11) NOT NULL, `program` varchar(30) NOT NULL, `semester` int(11) NOT NULL, `srollno` varchar(30) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `student` -- INSERT INTO `student` (`sname`, `departmentid`, `program`, `semester`, `srollno`) VALUES ('Tarun', 1, 'B-Tech', 7, 'B170594CS'); -- -------------------------------------------------------- -- -- Table structure for table `studentprofile` -- CREATE TABLE `studentprofile` ( `susername` varchar(30) NOT NULL, `spassword` varchar(30) NOT NULL, `sid` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `studentprofile` -- INSERT INTO `studentprofile` (`susername`, `spassword`, `sid`) VALUES ('B170594CS', 'Tarun', 3); -- -- Indexes for dumped tables -- -- -- Indexes for table `absentdates` -- ALTER TABLE `absentdates` ADD PRIMARY KEY (`courseid`,`studentrollno`,`absentdates`), ADD KEY `absentdates_ibfk_2` (`studentrollno`); -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`ID`); -- -- Indexes for table `attendance` -- ALTER TABLE `attendance` ADD PRIMARY KEY (`courseid`,`srollno`), ADD KEY `attendance_ibfk_2` (`srollno`); -- -- Indexes for table `course` -- ALTER TABLE `course` ADD PRIMARY KEY (`cid`); -- -- Indexes for table `department` -- ALTER TABLE `department` ADD PRIMARY KEY (`did`); -- -- Indexes for table `faculty` -- ALTER TABLE `faculty` ADD PRIMARY KEY (`fid`), ADD KEY `faculty_ibfk_1` (`departmentid`); -- -- Indexes for table `student` -- ALTER TABLE `student` ADD PRIMARY KEY (`srollno`), ADD KEY `student_ibfk_1` (`departmentid`); -- -- Indexes for table `studentprofile` -- ALTER TABLE `studentprofile` ADD PRIMARY KEY (`sid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin` -- ALTER TABLE `admin` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `faculty` -- ALTER TABLE `faculty` MODIFY `fid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `studentprofile` -- ALTER TABLE `studentprofile` MODIFY `sid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- Constraints for dumped tables -- -- -- Constraints for table `absentdates` -- ALTER TABLE `absentdates` ADD CONSTRAINT `absentdates_ibfk_1` FOREIGN KEY (`courseid`) REFERENCES `course` (`cid`) ON UPDATE CASCADE, ADD CONSTRAINT `absentdates_ibfk_2` FOREIGN KEY (`studentrollno`) REFERENCES `student` (`srollno`) ON UPDATE CASCADE; -- -- Constraints for table `attendance` -- ALTER TABLE `attendance` ADD CONSTRAINT `attendance_ibfk_1` FOREIGN KEY (`courseid`) REFERENCES `course` (`cid`) ON UPDATE CASCADE, ADD CONSTRAINT `attendance_ibfk_2` FOREIGN KEY (`srollno`) REFERENCES `student` (`srollno`) ON UPDATE CASCADE; -- -- Constraints for table `faculty` -- ALTER TABLE `faculty` ADD CONSTRAINT `faculty_ibfk_1` FOREIGN KEY (`departmentid`) REFERENCES `department` (`did`) ON UPDATE CASCADE; -- -- Constraints for table `student` -- ALTER TABLE `student` ADD CONSTRAINT `student_ibfk_1` FOREIGN KEY (`departmentid`) REFERENCES `department` (`did`) ON UPDATE CASCADE; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- MySQL Workbench Forward Engineering SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema restaurantdb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema restaurantdb -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `restaurantdb` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ; USE `restaurantdb` ; -- ----------------------------------------------------- -- Table `restaurantdb`.`food` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `restaurantdb`.`food` ( `food_id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NULL DEFAULT NULL, `price` DOUBLE NULL DEFAULT NULL, PRIMARY KEY (`food_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ----------------------------------------------------- -- Table `restaurantdb`.`persons` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `restaurantdb`.`persons` ( `person_id` INT(11) NOT NULL AUTO_INCREMENT, `address` VARCHAR(255) NULL DEFAULT NULL, `birthday` DATE NULL DEFAULT NULL, `name` VARCHAR(255) NULL DEFAULT NULL, `surname` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`person_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ----------------------------------------------------- -- Table `restaurantdb`.`order_food` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `restaurantdb`.`order_food` ( `order_id` INT(11) NOT NULL AUTO_INCREMENT, `order_date` DATE NULL DEFAULT NULL, `total_price` DOUBLE NULL DEFAULT NULL, `type_of_payment` VARCHAR(255) NULL DEFAULT NULL, `person_id` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`order_id`), INDEX `FKik63wlqd4xrkxp25ctfue6skm` (`person_id` ASC) VISIBLE, CONSTRAINT `FKik63wlqd4xrkxp25ctfue6skm` FOREIGN KEY (`person_id`) REFERENCES `restaurantdb`.`persons` (`person_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ----------------------------------------------------- -- Table `restaurantdb`.`order_details` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `restaurantdb`.`order_details` ( `order_details_id` INT(11) NOT NULL AUTO_INCREMENT, `price_unit` DOUBLE NULL DEFAULT NULL, `quantity` INT(11) NULL DEFAULT NULL, `food` INT(11) NULL DEFAULT NULL, `order_food_order_id` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`order_details_id`), INDEX `FKqqfksaj2qey1sloerv2lrp3w7` (`food` ASC) VISIBLE, INDEX `FKq4n76d6dncsdktwv3hou9ub9k` (`order_food_order_id` ASC) VISIBLE, CONSTRAINT `FKq4n76d6dncsdktwv3hou9ub9k` FOREIGN KEY (`order_food_order_id`) REFERENCES `restaurantdb`.`order_food` (`order_id`), CONSTRAINT `FKqqfksaj2qey1sloerv2lrp3w7` FOREIGN KEY (`food`) REFERENCES `restaurantdb`.`food` (`food_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ----------------------------------------------------- -- Table `restaurantdb`.`roles` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `restaurantdb`.`roles` ( `role_id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NULL DEFAULT NULL, PRIMARY KEY (`role_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ----------------------------------------------------- -- Table `restaurantdb`.`persons_role` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `restaurantdb`.`persons_role` ( `persons_person_id` INT(11) NOT NULL, `role_role_id` INT(11) NOT NULL, INDEX `FKsb7hah8v1bme7cgwxhba5uuar` (`role_role_id` ASC) VISIBLE, INDEX `FKk559gkje476lss8laxsl89enj` (`persons_person_id` ASC) VISIBLE, CONSTRAINT `FKk559gkje476lss8laxsl89enj` FOREIGN KEY (`persons_person_id`) REFERENCES `restaurantdb`.`persons` (`person_id`), CONSTRAINT `FKsb7hah8v1bme7cgwxhba5uuar` FOREIGN KEY (`role_role_id`) REFERENCES `restaurantdb`.`roles` (`role_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ----------------------------------------------------- -- Table `restaurantdb`.`roles_persons_list_role` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `restaurantdb`.`roles_persons_list_role` ( `roles_role_id` INT(11) NOT NULL, `persons_list_role_person_id` INT(11) NOT NULL, INDEX `FKjq5vl9ur043mpalivofjlnk2x` (`persons_list_role_person_id` ASC) VISIBLE, INDEX `FKq7ttwawyya0kly683fhqu7y8u` (`roles_role_id` ASC) VISIBLE, CONSTRAINT `FKjq5vl9ur043mpalivofjlnk2x` FOREIGN KEY (`persons_list_role_person_id`) REFERENCES `restaurantdb`.`persons` (`person_id`), CONSTRAINT `FKq7ttwawyya0kly683fhqu7y8u` FOREIGN KEY (`roles_role_id`) REFERENCES `restaurantdb`.`roles` (`role_id`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
delete from detil_pembayaran_dana_rutin; delete from pembayaran_samanagara_sosial_tetap; delete from pendapatan; delete from pengeluaran; delete from kehadiran_siswa; delete from siswa; delete from pendaftaran_dana_rutin; update cell_papan set leluhur_smngr_id = null; delete from leluhur_smngr; delete from kehadiran; delete from umat;
-- A LIST ALL COLIMS SALES, TOTAL AMOUNT GREATER THAN 1000. SELECT * FROM SALES WHERE TOTAL_AMOUNT>1000; -- ALL FROM SALES, TOTAL!=44 SELECT * FROM SALES WHERE TOTAL_AMOUNT NOT IN(44); -- QUNATITY IS LESS THAN OR EQUAL TO 10. SELECT * FROM SALES WHERE QUANTITY<11; -- SALES DATE IS 9TH FEB 2015 SELECT * FROM SALES WHERE SALES_DATE ='09-FEB-15'; -- color = red SELECT * FROM PRODUCT WHERE COLOR='RED'; -- WHERE TOTAL>SALES AMOUNT SELECT * FROM SALES WHERE TOTAL_AMOUNT>SALES_AMOUNT;
SELECT player.player_name as bowler_name, final_bowler_ids_and_min_average.bowler_average as average FROM player INNER JOIN ( SELECT bowler_average_min_info.bowler as bowler, bowler_average_min_info.bowler_average as bowler_average FROM ( SELECT ball_bowler_run_wicket_info.bowler, ( SUM( ball_bowler_run_wicket_info.total_runs ) / SUM( ball_bowler_run_wicket_info.was_wicket ) ) as bowler_average, ( MIN( ( SUM( ball_bowler_run_wicket_info.total_runs ) / SUM( ball_bowler_run_wicket_info.was_wicket ) ) ) OVER () ) as min_bowler_average FROM ( SELECT ball_by_ball.match_id, ball_by_ball.over_id, ball_by_ball.ball_id, ball_by_ball.innings_no, ball_by_ball.bowler, ( IFNULL(batsman_scored.runs_scored, 0) + IFNULL(extra_runs.extra_runs, 0) ) as total_runs, IF( wicket_taken.kind_out IS NULL, 0, 1 ) as was_wicket FROM ball_by_ball LEFT OUTER JOIN batsman_scored ON ( ball_by_ball.match_id = batsman_scored.match_id AND ball_by_ball.over_id = batsman_scored.over_id AND ball_by_ball.ball_id = batsman_scored.ball_id AND ball_by_ball.innings_no = batsman_scored.innings_no ) LEFT OUTER JOIN extra_runs ON ( ball_by_ball.match_id = extra_runs.match_id AND ball_by_ball.over_id = extra_runs.over_id AND ball_by_ball.ball_id = extra_runs.ball_id AND ball_by_ball.innings_no = extra_runs.innings_no ) LEFT OUTER JOIN ( SELECT * FROM wicket_taken WHERE wicket_taken.kind_out IN ( 'bowled', 'caught', 'lbw', 'caught and bowled', 'stumped' ) ) as wicket_taken ON ( ball_by_ball.match_id = wicket_taken.match_id AND ball_by_ball.over_id = wicket_taken.over_id AND ball_by_ball.ball_id = wicket_taken.ball_id AND ball_by_ball.innings_no = wicket_taken.innings_no ) INNER JOIN `match` ON ( ball_by_ball.match_id = match.match_id ) WHERE match.season_id = 5 ) as ball_bowler_run_wicket_info GROUP BY ball_bowler_run_wicket_info.bowler HAVING (bowler_average IS NOT NULL) ) as bowler_average_min_info WHERE bowler_average_min_info.bowler_average = bowler_average_min_info.min_bowler_average ) as final_bowler_ids_and_min_average ON player.player_id = final_bowler_ids_and_min_average.bowler ORDER BY player.player_name DESC;
select * from DBA_SCHEDULER_REMOTE_JOBSTATE;
/* Replace with your SQL commands */ DROPS TABLE OF EXISTS note;
--修改人:陈春燕 --修改日期:2012-08-08 --修改内容: 新增自开票据历史状态汇总,库存票据历史状态汇总两个菜单 --修改原因:需求:PJ-JD03-014 ----新增自开票据历史状态汇总菜单 insert into BT_SYS_RES (RES_CODE, RES_NAME, SYS_CODE, FATHER_CODE, RES_URL, FUNC_FLAG, RES_TYPE, LINK_TARGET, STATUS, RES_ORDER, RMK, REVERSE1, REVERSE2, REVERSE3, REVERSE4, REVERSE5, REVERSE6, REVERSE7, REVERSE8, REVERSE9, REVERSE10, RES_LEVEL, RES_ROLE) select (select max(RES_CODE) + 1 from bt_sys_res), '自开票据历史状态汇总', 'ads', RES_CODE, '/AB/billHisGather.do?method=toemitHisGather', '0', '1', '0', '0', 3, null, null, null, null, null, null, null, null, null, null, null, 2, '' from bt_sys_res where res_name = '查询统计' and SYS_CODE = 'ads'; ----新增库存票据历史状态汇总菜单 insert into BT_SYS_RES (RES_CODE, RES_NAME, SYS_CODE, FATHER_CODE, RES_URL, FUNC_FLAG, RES_TYPE, LINK_TARGET, STATUS, RES_ORDER, RMK, REVERSE1, REVERSE2, REVERSE3, REVERSE4, REVERSE5, REVERSE6, REVERSE7, REVERSE8, REVERSE9, REVERSE10, RES_LEVEL, RES_ROLE) select (select max(RES_CODE) + 1 from bt_sys_res), '库存票据历史状态汇总', 'ads', RES_CODE, '/AB/billHisGather.do?method=toreceiveHisGather', '0', '1', '0', '0', 3, null, null, null, null, null, null, null, null, null, null, null, 2, '' from bt_sys_res where res_name = '查询统计' and SYS_CODE = 'ads'; commit;
create or replace package PK_T006_PROY_SECTR_IMPLMNTDR is /**************************************************************************************** DESCRIPCION : Contiene los servicios CRUD sobre la tabla T006_PROY_SECTR_IMPLMNTDR REALIZADO POR : Luis Felipe Galeano Castro FECHA CREACION : 10/11/2016 FECHA MODIFICA : 02/12/2017 MODIFICADO POR : Luis Felipe Galeano Castro DESCRIPCION CAMBIO: Ajustes a los metodos, se eliminan Listar y consultar por Id ******************************************************************************************/ NOMBRE_PAQUETE CONSTANT VARCHAR2(100) := 'PK_T006_PROY_SECTR_IMPLMNTDR'; TYPE CURSOR_SALIDA IS REF CURSOR; -- Funciones y Procedimientos del paquete PROCEDURE Pr_Insertar (p_A006IDPROYECTO IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006IDPROYECTO%TYPE, p_A006IDSECTRIMPLMNTDR IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006IDSECTRIMPLMNTDR%TYPE, p_A006DETALLEOTRO IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006DETALLEOTRO%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); PROCEDURE Pr_Eliminar (p_A006CODIGO IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006CODIGO%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); PROCEDURE Pr_Actualizar (p_A006CODIGO IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006CODIGO%TYPE, p_A006IDPROYECTO IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006IDPROYECTO%TYPE, p_A006IDSECTRIMPLMNTDR IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006IDSECTRIMPLMNTDR%TYPE, p_A006DETALLEOTRO IN GPYT_T006_PROY_SECTR_IMPLMNTDR.A006DETALLEOTRO%TYPE, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); PROCEDURE Pr_ConsultarPorFiltro (p_Filtro IN VARCHAR2, p_idUsuario IN NUMBER, p_resultado OUT CURSOR_SALIDA, p_codError OUT NUMBER, p_msjError OUT VARCHAR2); end PK_T006_PROY_SECTR_IMPLMNTDR;
-- getsid.sql -- get sid for current session col sid format a12 head 'SID' select sys_context('userenv','sid') sid from dual;
-- Create Database Create database ResidentialLife -- Create Table DeskAssistant USE ResidentialLife CREATE TABLE dbo.DeskAssistant ( Username varchar(255) PRIMARY KEY, EmailId varchar(255) NOT NULL UNIQUE, Password varchar(255) NOT NULL, Name varchar(255) NOT NULL ); DROP TABLE dbo.DeskAssistant -- Create Table Resident USE ResidentialLife CREATE TABLE dbo.Resident ( StudentId INT, ResidentName VARCHAR(255) NOT NULL, Gender VARCHAR(255) NOT NULL, CHECK(Gender IN ('M','F','O')), PhoneNo VARCHAR(15), EmailId VARCHAR(255) NOT NULL UNIQUE, Hall varchar(255) NOT NULL, RoomNo INT NOT NULL, DateOfBirth DATE NOT NULL, CHECK(DATEDIFF(YEAR,DateOfBirth,GETDATE())>16), Balance DECIMAL NOT NULL, CHECK(Balance>0), PRIMARY KEY(StudentId) ); DROP TABLE dbo.Resident -- Create Table GuestLog USE ResidentialLife CREATE TABLE dbo.GuestLog( GuestLogId INT IDENTITY(1,1) PRIMARY KEY, ResidentName VARCHAR(255) NOT NULL, GuestName VARCHAR(255) NOT NULL, StudentId INT NOT NULL, Guest_In DATETIME NOT NULL DEFAULT GETDATE(), Guest_Out DATETIME NOT NULL, FOREIGN KEY (StudentId) REFERENCES dbo.Resident(StudentId) ); DROP TABLE dbo.GuestLog -- Create Table Package USE ResidentialLife CREATE TABLE dbo.Package( PackageId INT IDENTITY(1,1) PRIMARY KEY, StudentId INT NOT NULL, Perishable BIT NOT NULL, Date_In DATE NOT NULL DEFAULT GETDATE(), Date_Out DATE NOT NULL, FOREIGN KEY (StudentId) REFERENCES dbo.Resident(StudentId) ); DROP TABLE dbo.Package -- Create Table Equipment USE ResidentialLife CREATE TABLE dbo.Equipment( EquipmentId INT IDENTITY(1,1) PRIMARY KEY, StudentId INT NOT NULL, ItemName VARCHAR(255) NOT NULL, Availability INT, CHECK(Availability>0), Damaged BIT NOT NULL, Date_In DATETIME NOT NULL DEFAULT GETDATE(), Date_Out DATETIME NOT NULL, FOREIGN KEY (StudentId) REFERENCES dbo.Resident(StudentId), FOREIGN KEY (ItemName) REFERENCES dbo.Stock(ItemName) ); DROP TABLE dbo.Equipment -- Create Table Cafe USE ResidentialLife CREATE TABLE dbo.Cafe( ItemId INT IDENTITY(1,1) PRIMARY KEY, StudentId INT NOT NULL, ItemName VARCHAR(255) NOT NULL, Availability INT, CHECK(Availability>0), NoOfItems INT NOT NULL, CHECK(NoOfItems>0), Price DECIMAL NOT NULL, CHECK(Price>0), FOREIGN KEY (StudentId) REFERENCES dbo.Resident(StudentId), FOREIGN KEY (ItemName) REFERENCES dbo.Stock(ItemName) ); DROP TABLE dbo.Cafe -- Create Table Stock USE ResidentialLife CREATE TABLE dbo.Stock( ItemName VARCHAR(255) PRIMARY KEY, ItemCount INT DEFAULT 0 ); DROP TABLE dbo.Stock
-- 伺服器: localhost 資料庫: work2009 -- phpMyAdmin SQL Dump -- version 2.10.3 -- http://www.phpmyadmin.net -- -- 主機: localhost -- 建立日期: Jul 22, 2009, 03:54 PM -- 伺服器版本: 5.0.51 -- PHP 版本: 5.2.6 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- 資料庫: `work2009` -- -- -------------------------------------------------------- -- -- 資料表格式: `workv1_question_check` -- CREATE TABLE `workv1_question_check` ( `id` int(11) NOT NULL, `uno` int(11) NOT NULL, `check` tinyint(1) NOT NULL default '0', `answer` varchar(300) collate utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 資料表格式: `workv1_question_chooses` -- CREATE TABLE `workv1_question_chooses` ( `id` int(11) NOT NULL, `gid` int(11) NOT NULL, `cid` int(11) NOT NULL, `sort` double NOT NULL, `content` text collate utf8_unicode_ci NOT NULL, `others` tinyint(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 資料表格式: `workv1_question_question` -- CREATE TABLE `workv1_question_question` ( `id` int(11) NOT NULL, `gid` int(11) NOT NULL, `sort` double NOT NULL, `question` text collate utf8_unicode_ci NOT NULL, `type` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 資料表格式: `workv1_question_topic` -- CREATE TABLE `workv1_question_topic` ( `id` int(11) NOT NULL, `sort` double NOT NULL, `topic` text collate utf8_unicode_ci NOT NULL, `description` text collate utf8_unicode_ci NOT NULL, `public` int(11) NOT NULL, `number` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/* Создание таблицы документов */ CREATE TABLE /*PREFIX*/DOCS ( DOC_ID VARCHAR(32) NOT NULL, VIEW_ID VARCHAR(32) NOT NULL, NUM VARCHAR(50) NOT NULL, DATE_DOC DATETIME NOT NULL, NAME VARCHAR(100) NOT NULL, DESCRIPTION VARCHAR(250), PRIMARY KEY (DOC_ID), FOREIGN KEY (VIEW_ID) REFERENCES /*PREFIX*/VIEWS (VIEW_ID) ) -- /* Создание просмотра таблицы документов */ CREATE VIEW /*PREFIX*/S_DOCS AS SELECT D.*, V.NAME AS VIEW_NAME FROM /*PREFIX*/DOCS D JOIN /*PREFIX*/VIEWS V ON V.VIEW_ID=D.VIEW_ID -- /* Создание процедуры добавления документа */ CREATE PROCEDURE /*PREFIX*/I_DOC @DOC_ID VARCHAR(32), @VIEW_ID VARCHAR(32), @NUM VARCHAR(50), @DATE_DOC DATETIME, @NAME VARCHAR(100), @DESCRIPTION VARCHAR(250) AS BEGIN INSERT INTO /*PREFIX*/DOCS (DOC_ID,VIEW_ID,NUM,DATE_DOC,NAME,DESCRIPTION) VALUES (@DOC_ID,@VIEW_ID,@NUM,@DATE_DOC,@NAME,@DESCRIPTION); END; -- /* Создание процедуры изменения документа */ CREATE PROCEDURE /*PREFIX*/U_DOC @DOC_ID VARCHAR(32), @VIEW_ID VARCHAR(32), @NUM VARCHAR(50), @DATE_DOC DATETIME, @NAME VARCHAR(100), @DESCRIPTION VARCHAR(250), @OLD_DOC_ID VARCHAR(32) AS BEGIN UPDATE /*PREFIX*/DOCS SET DOC_ID=@DOC_ID, VIEW_ID=@VIEW_ID, NUM=@NUM, DATE_DOC=@DATE_DOC, NAME=@NAME, DESCRIPTION=@DESCRIPTION WHERE DOC_ID=@OLD_DOC_ID; END; -- /* Создание процедуры удаления документа */ CREATE PROCEDURE /*PREFIX*/D_DOC @OLD_DOC_ID VARCHAR(32) AS BEGIN DELETE FROM /*PREFIX*/DOCS WHERE DOC_ID=@OLD_DOC_ID; END; --
INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES ("Mr. Chocolate", 8, "m", "chocolate", "lazy", "True"); INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES ("Rowdy", 4, "f", "chestnut", "rambunctious", "True"); INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES ("Tabitha", 19, "f", "auburn", "steady", "True"); INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES ("Sergeant Brown", 17, "m", "brown", "indifferent", "True"); INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES ("Melissa", 11, "f", "brown", "agressive", "True"); INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES ("Grinch", 17, "f", "salt and pepper", "avoidant", "True"); INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES ("Wendy", 9, "f", "chestnut", "docile", "True"); INSERT INTO bears (name, age, gender, color, temperament, alive) VALUES (Null, 5, "m", "brown", "RUN AWAY", "False");
------------------------------------ --Author: Jeffrey Yu --RevisedDate: 2016-3-31 ------------------------------------ select distinct (us.FirstName+' '+us.LastName) as [Cutter], count(distinct fdd.FilingId) as [CuttingWorkLoad] from GlobalDocumentData..FilingDistributionDetail as fdd left join GlobalDocumentData..SECEdgar as f on f.FilingId=fdd.FilingId left join SupportData..UserSearch as us on us.UserId=fdd.UserId where f.Status=2 and f.FileDate>=getdate()-9 group by us.FirstName+' '+us.LastName order by count(distinct fdd.FilingId) desc
select ALMTXT from ALMTXT where ALMID = :ALMID and NLANGCOD = :NLANGCOD
drop table reviewrating; create table reviewrating ( USERNO VARCHAR2(20) REVIEW VARCHAR2(100) RATING NUMBER(2) );
declare v_today date; v_id VARCHAR2(100); v_pa VARCHAR2(10); begin for i in 1..1000000 loop select sysdate into v_today from dual; select dbms_random.string('X', 20) into v_id from dual; insert into prova values(v_id, v_pa, v_today); end loop; commit; end;
-- -- 数据库: 'svcart_data_demo' -- -- -- 导出表中的数据 'svcart_advertisements' -- -- -- 导出表中的数据 'svcart_advertisement_i18ns' -- -- -- 导出表中的数据 'svcart_articles' -- -- -- 导出表中的数据 'svcart_article_categories' -- -- -- 导出表中的数据 'svcart_article_i18ns' -- -- -- 导出表中的数据 'svcart_booking_products' -- -- -- 导出表中的数据 'svcart_brands' -- INSERT INTO svcart_brands (id, orderby, img01, img02, flash_config, status, url, created, modified) VALUES (1, 0, ' ', '', '', '1', '', '2009-04-09 05:39:46', '2009-04-09 05:39:46'); -- -- 导出表中的数据 'svcart_brand_i18ns' -- INSERT INTO svcart_brand_i18ns (id, locale, brand_id, name, description, meta_keywords, meta_description, img01, img02, img03, created, modified) VALUES (1, 'chi', 1, '品牌01', '品牌01', '品牌01', '品牌01', NULL, '', NULL, '2009-04-09 05:45:26', '2009-04-09 05:45:26'), (2, 'eng', 1, 'brand01', 'brand01', 'brand01', 'brand01', NULL, '', NULL, '2009-04-09 05:45:26', '2009-04-09 05:45:26'); -- -- 导出表中的数据 'svcart_cards' -- -- -- 导出表中的数据 'svcart_card_i18ns' -- -- -- 导出表中的数据 'svcart_carts' -- -- -- 导出表中的数据 'svcart_categories' -- INSERT INTO svcart_categories (id, parent_id, type, orderby, status, link, img01, img02, created, modified) VALUES (10, 0, 'P', 5, '1', '', '', '', '2009-03-16 05:02:27', '2009-04-23 05:21:56'); -- -- 导出表中的数据 'svcart_category_i18ns' -- INSERT INTO svcart_category_i18ns (locale, category_id, name, meta_keywords, meta_description, detail, img01, img02, img03, created, modified) VALUES ('chi', 10, '饰品与配件', '饰品与配件', '饰品与配件', '', '', '', NULL, '2009-03-16 05:02:27', '2009-04-23 05:21:56'), ('eng', 10, 'Jewelry', 'Jewelry', 'Jewelry', '', '', '', NULL, '2009-03-16 05:02:27', '2009-04-23 05:21:56'); -- -- 导出表中的数据 'svcart_comments' -- -- -- 导出表中的数据 'svcart_configs' -- -- -- 导出表中的数据 'svcart_config_i18ns' -- -- -- 导出表中的数据 'svcart_coupons' -- -- -- 导出表中的数据 'svcart_coupon_types' -- -- -- 导出表中的数据 'svcart_coupon_type_i18ns' -- -- -- 导出表中的数据 'svcart_departments' -- -- -- 导出表中的数据 'svcart_department_i18ns' -- -- -- 导出表中的数据 'svcart_flashes' -- -- -- 导出表中的数据 'svcart_flash_images' -- -- -- 导出表中的数据 'svcart_languages' -- -- -- 导出表中的数据 'svcart_language_dictionaries' -- -- -- 导出表中的数据 'svcart_links' -- -- -- 导出表中的数据 'svcart_link_i18ns' -- -- -- 导出表中的数据 'svcart_mail_templates' -- -- -- 导出表中的数据 'svcart_mail_template_i18ns' -- -- -- 导出表中的数据 'svcart_navigations' -- -- -- 导出表中的数据 'svcart_navigation_i18ns' -- -- -- 导出表中的数据 'svcart_newsletter_lists' -- -- -- 导出表中的数据 'svcart_operators' -- -- -- 导出表中的数据 'svcart_operator_actions' -- -- -- 导出表中的数据 'svcart_operator_action_i18ns' -- -- -- 导出表中的数据 'svcart_operator_logs' -- -- -- 导出表中的数据 'svcart_operator_menus' -- -- -- 导出表中的数据 'svcart_operator_menu_i18ns' -- -- -- 导出表中的数据 'svcart_operator_roles' -- -- -- 导出表中的数据 'svcart_operator_role_i18ns' -- -- -- 导出表中的数据 'svcart_orders' -- -- -- 导出表中的数据 'svcart_order_actions' -- -- -- 导出表中的数据 'svcart_order_cards' -- -- -- 导出表中的数据 'svcart_order_packagings' -- -- -- 导出表中的数据 'svcart_order_products' -- -- -- 导出表中的数据 'svcart_packagings' -- -- -- 导出表中的数据 'svcart_packaging_i18ns' -- -- -- 导出表中的数据 'svcart_payments' -- -- -- 导出表中的数据 'svcart_payment_api_logs' -- -- -- 导出表中的数据 'svcart_payment_i18ns' -- -- -- 导出表中的数据 'svcart_products' -- INSERT INTO svcart_products (id, coupon_type_id, brand_id, provider_id, category_id, code, product_name_style, img_thumb, img_detail, img_original, recommand_flag, min_buy, max_buy, admin_id, alone, forsale, status, weight, market_price, shop_price, promotion_price, promotion_start, promotion_end, promotion_status, point, point_fee, view_stat, sale_stat, product_type_id, product_rank_id, quantity, extension_code, created, modified) VALUES (1, 0, 1, 0, 10, 'svcart000001', '+', '/img/products/svcart000001/49b0623e.jpg', '/img/products/svcart000001/detail/49b0623e.jpg', '/img/products/svcart000001/original/49b0623e.jpg', '0', 1, 100, 0, '1', '1', '1', 20.000, 20000.00, 20000.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 05:48:31', '2009-04-10 03:58:30'), (2, 0, 1, 0, 10, 'svcart000002', '+', '/img/products/svcart000002/49b6c124.jpg', '/img/products/svcart000002/detail/49b6c124.jpg', '/img/products/svcart000002/original/49b6c124.jpg', '0', 1, 100, 0, '1', '1', '1', 45.000, 50000.00, 50000.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:20:36', '2009-04-10 03:57:49'), (3, 0, 1, 0, 10, 'svcart000003', '+', '/img/products/svcart000003/49b75709.jpg', '/img/products/svcart000003/detail/49b75709.jpg', '/img/products/svcart000003/original/49b75709.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 10000.00, 10000.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:22:57', '2009-04-10 03:56:34'), (4, 0, 1, 0, 10, 'svcart000004', '+', '/img/products/svcart000004/49ba9400.jpg', '/img/products/svcart000004/detail/49ba9400.jpg', '/img/products/svcart000004/original/49ba9400.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 6660.00, 6660.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:25:42', '2009-04-10 03:54:43'), (5, 0, 1, 0, 10, 'svcart000005', '+', '/img/products/svcart000005/49b00d3b.jpg', '/img/products/svcart000005/detail/49b00d3b.jpg', '/img/products/svcart000005/original/49b00d3b.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 3000.00, 3000.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:27:43', '2009-04-10 03:53:02'), (6, 0, 1, 0, 10, 'svcart000006', '+', '/img/products/svcart000006/49b6086e.jpg', '/img/products/svcart000006/detail/49b6086e.jpg', '/img/products/svcart000006/original/49b6086e.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 2000.00, 2000.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:28:16', '2009-04-10 03:52:04'), (7, 0, 1, 0, 10, 'svcart000007', '+', '/img/products/svcart000007/49bd0029.jpg', '/img/products/svcart000007/detail/49bd0029.jpg', '/img/products/svcart000007/original/49bd0029.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 29999.00, 29999.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:28:50', '2009-04-10 03:43:58'), (8, 0, 1, 0, 10, 'svcart000008', '+', '/img/products/svcart000008/49b584a2.jpg', '/img/products/svcart000008/detail/49b584a2.jpg', '/img/products/svcart000008/original/49b584a2.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 3000.00, 3000.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:29:40', '2009-04-10 03:43:13'), (9, 0, 1, 0, 10, 'svcart000009', '+', '/img/products/svcart000009/49b9b1d0.jpg', '/img/products/svcart000009/detail/49b9b1d0.jpg', '/img/products/svcart000009/original/49b9b1d0.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 3000.00, 3000.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:30:15', '2009-04-10 03:42:14'), (10, 0, 1, 0, 10, 'svcart000010', '+', '/img/products/svcart000010/49bfa424.jpg', '/img/products/svcart000010/detail/49bfa424.jpg', '/img/products/svcart000010/original/49bfa424.jpg', '0', 1, 100, 0, '1', '1', '1', 0.000, 4999.00, 4999.00, 0.00, '2008-01-01 00:00:00', '2008-01-01 00:00:00', '0', 0, '0', 0, 0, 0, 0, 5, '', '2009-04-09 09:30:48', '2009-04-10 03:41:19'); -- -- 导出表中的数据 'svcart_products_categories' -- -- -- 导出表中的数据 'svcart_product_articles' -- -- -- 导出表中的数据 'svcart_product_attributes' -- -- -- 导出表中的数据 'svcart_product_galleries' -- INSERT INTO svcart_product_galleries (id, product_id, img_thumb, img_detail, img_original, orderby, status, created, modified) VALUES (1, 1, '/img/products/svcart000001/49b0623e.jpg', '/img/products/svcart000001/detail/49b0623e.jpg', '/img/products/svcart000001/original/49b0623e.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (2, 2, '/img/products/svcart000002/49b6c124.jpg', '/img/products/svcart000002/detail/49b6c124.jpg', '/img/products/svcart000002/original/49b6c124.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (3, 3, '/img/products/svcart000003/49b75709.jpg', '/img/products/svcart000003/detail/49b75709.jpg', '/img/products/svcart000003/original/49b75709.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (4, 4, '/img/products/svcart000004/49ba9400.jpg', '/img/products/svcart000004/detail/49ba9400.jpg', '/img/products/svcart000004/original/49ba9400.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (5, 5, '/img/products/svcart000005/49b00d3b.jpg', '/img/products/svcart000005/detail/49b00d3b.jpg', '/img/products/svcart000005/original/49b00d3b.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (6, 6, '/img/products/svcart000006/49b6086e.jpg', '/img/products/svcart000006/detail/49b6086e.jpg', '/img/products/svcart000006/original/49b6086e.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (7, 7, '/img/products/svcart000007/49bd0029.jpg', '/img/products/svcart000007/detail/49bd0029.jpg', '/img/products/svcart000007/original/49bd0029.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (8, 8, '/img/products/svcart000008/49b584a2.jpg', '/img/products/svcart000008/detail/49b584a2.jpg', '/img/products/svcart000008/original/49b584a2.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (9, 9, '/img/products/svcart000009/49b9b1d0.jpg', '/img/products/svcart000009/detail/49b9b1d0.jpg', '/img/products/svcart000009/original/49b9b1d0.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'), (10, 10, '/img/products/svcart000010/49bfa424.jpg', '/img/products/svcart000010/detail/49bfa424.jpg', '/img/products/svcart000010/original/49bfa424.jpg', 5, '1', '2009-03-24 06:42:58', '2009-03-24 06:42:58'); -- -- 导出表中的数据 'svcart_product_gallery_i18ns' -- -- -- 导出表中的数据 'svcart_product_i18ns' -- INSERT INTO svcart_product_i18ns (id, locale, product_id, name, description, market_price, shop_price, meta_keywords, meta_description, api_site_url, api_cart_url, created, modified) VALUES (1, 'chi', 1, '梦幻紫水晶耳扣', '', 0.00, 0.00, '梦幻紫水晶耳扣', '梦幻紫水晶耳扣', '', '', '2009-04-09 05:48:31', '2009-04-09 05:48:31'), (2, 'chi', 2, '天海蓝钻戒', '', 0.00, 0.00, '天海蓝钻戒', '天海蓝钻戒', '', '', '2009-04-09 09:20:36', '2009-04-09 09:21:22'), (3, 'chi', 3, '传统玻璃手镯', '', 0.00, 0.00, '传统玻璃手镯', '传统玻璃手镯', '', '', '2009-04-09 09:22:57', '2009-04-09 09:24:53'), (4, 'chi', 4, '观音琉璃挂件', '', 0.00, 0.00, '观音琉璃挂件', '观音琉璃挂件', '', '', '2009-04-09 09:25:42', '2009-04-09 09:26:55'), (5, 'chi', 5, '东方古典翡翠玉耳环', '', 0.00, 0.00, '东方古典翡翠玉耳环', '东方古典翡翠玉耳环', '', '', '2009-04-09 09:27:43', '2009-04-09 09:32:56'), (6, 'chi', 6, '中国柱状玉耳环', '', 0.00, 0.00, '中国柱状玉耳环', '中国柱状玉耳环', '', '', '2009-04-09 09:28:16', '2009-04-09 09:32:40'), (7, 'chi', 7, '观音玉坠', '', 0.00, 0.00, '观音玉坠', '观音玉坠', '', '', '2009-04-09 09:28:50', '2009-04-09 09:32:23'), (8, 'chi', 8, '银龙玉坠', '', 0.00, 0.00, '银龙玉坠', '银龙玉坠', '', '', '2009-04-09 09:29:40', '2009-04-09 09:31:43'), (9, 'chi', 9, '中国佛琉璃挂件', '', 0.00, 0.00, '中国佛琉璃挂件', '中国佛琉璃挂件', '', '', '2009-04-09 09:30:15', '2009-04-09 09:31:26'), (10, 'chi', 10, '活动贝壳项链', '', 0.00, 0.00, '活动贝壳项链', '活动贝壳项链', '', '', '2009-04-09 09:30:48', '2009-04-09 09:31:10'), (11, 'eng', 1, '梦幻紫水晶耳扣', '', 0.00, 0.00, '梦幻紫水晶耳扣', '梦幻紫水晶耳扣', '', '', '2009-04-09 05:48:31', '2009-04-09 05:48:31'), (12, 'eng', 2, '天海蓝钻戒', '', 0.00, 0.00, '天海蓝钻戒', '天海蓝钻戒', '', '', '2009-04-09 09:20:36', '2009-04-09 09:21:22'), (13, 'eng', 3, '传统玻璃手镯', '', 0.00, 0.00, '传统玻璃手镯', '传统玻璃手镯', '', '', '2009-04-09 09:22:57', '2009-04-09 09:24:53'), (14, 'eng', 4, '观音琉璃挂件', '', 0.00, 0.00, '观音琉璃挂件', '观音琉璃挂件', '', '', '2009-04-09 09:25:42', '2009-04-09 09:26:55'), (15, 'eng', 5, '东方古典翡翠玉耳环', '', 0.00, 0.00, '东方古典翡翠玉耳环', '东方古典翡翠玉耳环', '', '', '2009-04-09 09:27:43', '2009-04-09 09:32:56'), (16, 'eng', 6, '中国柱状玉耳环', '', 0.00, 0.00, '中国柱状玉耳环', '中国柱状玉耳环', '', '', '2009-04-09 09:28:16', '2009-04-09 09:32:40'), (17, 'eng', 7, '观音玉坠', '', 0.00, 0.00, '观音玉坠', '观音玉坠', '', '', '2009-04-09 09:28:50', '2009-04-09 09:32:23'), (18, 'eng', 8, '银龙玉坠', '', 0.00, 0.00, '银龙玉坠', '银龙玉坠', '', '', '2009-04-09 09:29:40', '2009-04-09 09:31:43'), (19, 'eng', 9, '中国佛琉璃挂件', '', 0.00, 0.00, '中国佛琉璃挂件', '中国佛琉璃挂件', '', '', '2009-04-09 09:30:15', '2009-04-09 09:31:26'), (20, 'eng', 10, '活动贝壳项链', '', 0.00, 0.00, '活动贝壳项链', '活动贝壳项链', '', '', '2009-04-09 09:30:48', '2009-04-09 09:31:10'); -- -- 导出表中的数据 'svcart_product_ranks' -- -- -- 导出表中的数据 'svcart_product_relations' -- -- -- 导出表中的数据 'svcart_product_types' -- -- -- 导出表中的数据 'svcart_product_type_attributes' -- -- -- 导出表中的数据 'svcart_product_type_attribute_i18ns' -- -- -- 导出表中的数据 'svcart_product_type_i18ns' -- -- -- 导出表中的数据 'svcart_promotions' -- -- -- 导出表中的数据 'svcart_promotion_i18ns' -- -- -- 导出表中的数据 'svcart_promotion_products' -- -- -- 导出表中的数据 'svcart_providers' -- -- -- 导出表中的数据 'svcart_provider_products' -- -- -- 导出表中的数据 'svcart_regions' -- -- -- 导出表中的数据 'svcart_region_i18ns' -- -- -- 导出表中的数据 'svcart_sessions' -- -- -- 导出表中的数据 'svcart_shippings' -- -- -- 导出表中的数据 'svcart_shipping_areas' -- INSERT INTO svcart_shipping_areas (id, store_id, shipping_id, orderby, status, fee_configures, free_subtotal, created, modified) VALUES (1000, 0, 1, 0, '1', 'a:3:{i:0;a:1:{s:5:"value";s:3:"454";}i:1;a:1:{s:5:"value";s:3:"454";}i:2;a:1:{s:5:"value";s:3:"545";}}', 454.00, '2009-04-14 09:53:44', '2009-05-22 11:25:12'), (1001, 0, 2, 1, '1', 'a:3:{i:0;a:1:{s:5:"value";s:3:"454";}i:1;a:1:{s:5:"value";s:3:"454";}i:2;a:1:{s:5:"value";s:3:"545";}}', 454.00, '2009-04-14 09:53:44', '2009-05-22 11:24:56'); -- -- 导出表中的数据 'svcart_shipping_area_i18ns' -- INSERT INTO svcart_shipping_area_i18ns (id, locale, shipping_area_id, name, description, created, modified) VALUES (1, 'chi', 1000, '中国', '中国各地', '2009-04-14 06:01:07', '2009-04-14 06:01:07'), (2, 'chi', 1001, '中国', '中国各地', '2009-04-14 06:01:07', '2009-04-14 06:01:07'), (3, 'eng', 1000, 'China', 'All over China', '2009-04-14 06:01:07', '2009-04-14 06:01:07'), (4, 'eng', 1001, 'China', 'All over China', '2009-04-14 06:01:07', '2009-04-14 06:01:07'); -- -- 导出表中的数据 'svcart_shipping_area_regions' -- INSERT INTO svcart_shipping_area_regions (id, shipping_area_id, region_id, created, modified) VALUES (1, 1001, 1, '2009-05-22 11:24:56', '2009-05-22 11:24:56'), (2, 1000, 1, '2009-05-22 11:25:12', '2009-05-22 11:25:12'); -- -- 导出表中的数据 'svcart_shipping_i18ns' -- -- -- 导出表中的数据 'svcart_stores' -- -- -- 导出表中的数据 'svcart_store_i18ns' -- -- -- 导出表中的数据 'svcart_store_products' -- -- -- 导出表中的数据 'svcart_templates' -- -- -- 导出表中的数据 'svcart_topics' -- -- -- 导出表中的数据 'svcart_topic_i18ns' -- -- -- 导出表中的数据 'svcart_topic_products' -- -- -- 导出表中的数据 'svcart_users' -- -- -- 导出表中的数据 'svcart_user_accounts' -- -- -- 导出表中的数据 'svcart_user_addresses' -- -- -- 导出表中的数据 'svcart_user_balance_logs' -- -- -- 导出表中的数据 'svcart_user_configs' -- -- -- 导出表中的数据 'svcart_user_config_i18ns' -- -- -- 导出表中的数据 'svcart_user_favorites' -- -- -- 导出表中的数据 'svcart_user_friends' -- -- -- 导出表中的数据 'svcart_user_friend_cats' -- -- -- 导出表中的数据 'svcart_user_infos' -- -- -- 导出表中的数据 'svcart_user_info_i18ns' -- -- -- 导出表中的数据 'svcart_user_info_values' -- -- -- 导出表中的数据 'svcart_user_messages' -- -- -- 导出表中的数据 'svcart_user_point_logs' -- -- -- 导出表中的数据 'svcart_user_ranks' -- -- -- 导出表中的数据 'svcart_user_rank_i18ns' -- -- -- 导出表中的数据 'svcart_virtual_cards' --
create table member( no number generated always as identity, id varchar2(512) primary key, password varchar2(512) not null, name varchar2(512) not null, gender varchar2(1) default 'M' ); select * from member; commit;
-- LABORATORY WORK 5 -- BY Mitrokhin_Oleksii Create or replace function func_order (cust_id in CUSTOMERS.CUST_ID %type) RETURN NUMBER is order_sum NUMBER begin select orders.order_num from customers join orders in customers.cust_id = orders.cust_id join orderitems in orders.order_num = orderitems.order_num where customers.cust_id = cust_id and orderitem.order_item = null group by orders.order_num having count(orders.order_num) into order_sum RETURN num end func_order; create or replace procedure key_order (prod_name in products.prod_name %type, order_id out orders.order_id %type) is order_id orders.order_id %type begin select orders.order_id into order_id from products join orderitems in products.prod_id = orderitems.prod_id where products.prod_name = prod_name group by orders.order_id exception when data not find end key_order; create or replace procedure prod_price_up (prod_name in products.prod_name %type) is prod_price products.prod_price %type begin select count(products.prod_id) as prod_count from products where products.prod_name = prod_name if prod_count = 1 update table products products.prod_price = 132; where products.prod_name = prod_name end if; exception when prod_count = 0 or prod_count = null end prod_price_up;
USE xdq3amktibtlrhrl; CREATE TABLE user ( id VARCHAR(15), nickname VARCHAR(20), email VARCHAR(20) ); INSERT INTO user(id, nickname, email) VALUES ("asdfmane", "asdf jkl", "somehaters@gmail.com"); -- INSERT INTO user(user_id, nickname, email) VALUES ("Portabelo Mushroom/Onion", false); -- INSERT INTO user(user_id, nickname, email) VALUES ("Bacon Wrapped Wagyu Beef/Aged Gouda", false);
CREATE OR REPLACE FUNCTION WXHF_GET_SUB_SPEC(LV_SO_NBR VARCHAR2, IP_SPEC_PRPTY_ID VARCHAR2, IP_ARC_LEVEL VARCHAR2 DEFAULT NULL, ip_product_id VARCHAR2 DEFAULT NULL) RETURN VARCHAR2 /** * ���� :������ֵ * @usage :<STRIKE></STRIKE> * @author :���º� * @created : * @param : IP_ARC_LEVEL �ֱ���ʾ��ǰ���߹鵵 * @return : ����ֵ,������ö��ֵ,��ȡ���� */ IS RESULT VARCHAR2(400); LV_ARC_LEVEL VARCHAR2(20); BEGIN LV_ARC_LEVEL := UPPER(NVL(IP_ARC_LEVEL, 'CUR')); IF LV_ARC_LEVEL IS NULL OR LV_ARC_LEVEL = 'CUR' THEN BEGIN SELECT NVL((SELECT SPV.NAME FROM SPEC_PRPTY_VALUE SPV -- unique key WHERE SPV.SPEC_PRPTY_VALUE_ID = SMPP.SPEC_PRPTY_VALUE AND SPV.SPEC_PRPTY_ID = SMPP.SPEC_PRPTY_ID) ,SMPP.SPEC_PRPTY_VALUE) INTO RESULT FROM So_Sub_Prod SMP, SO_sub_PROD_PRPTY SMPP WHERE SMP.SO_NBR = LV_SO_NBR AND (SMP.NO_FLAG = 'A' OR (SMP.NO_FLAG = 'P' AND SMP.ACT_TYPE = 'R')) AND SMP.STS = 'A' AND SMPP.STS = 'A' AND SMPP.SO_SUB_PROD_ID = SMP.SO_SUB_PROD_ID AND SMPP.SPEC_PRPTY_ID = to_char(IP_SPEC_PRPTY_ID) and (smp.prod_id = ip_product_id or ip_product_id is null) AND ROWNUM = 1; EXCEPTION WHEN no_data_found THEN RETURN NULL; WHEN OTHERS THEN RETURN SQLERRM; END; ELSIF LV_ARC_LEVEL = 'ARC' THEN BEGIN SELECT NVL((SELECT SPV.NAME FROM SPEC_PRPTY_VALUE SPV -- unique key WHERE SPV.SPEC_PRPTY_VALUE_ID = SMPP.SPEC_PRPTY_VALUE AND SPV.SPEC_PRPTY_ID = SMPP.SPEC_PRPTY_ID) ,SMPP.SPEC_PRPTY_VALUE) INTO RESULT FROM SO_sub_PROD_ARC SMP, SO_sub_PROD_PRPTY_arc SMPP WHERE SMP.SO_NBR = LV_SO_NBR AND (SMP.NO_FLAG = 'A' OR (SMP.NO_FLAG = 'P' AND SMP.ACT_TYPE = 'R')) AND SMP.STS = 'A' AND SMPP.STS = 'A' AND SMPP.SO_SUB_PROD_ID = SMP.SO_SUB_PROD_ID AND SMPP.SPEC_PRPTY_ID = to_char(IP_SPEC_PRPTY_ID) and (smp.prod_id = ip_product_id or ip_product_id is null) AND ROWNUM = 1; EXCEPTION WHEN no_data_found THEN RETURN NULL; WHEN OTHERS THEN RETURN SQLERRM; END; ELSE BEGIN SELECT NVL((SELECT SPV.NAME FROM SPEC_PRPTY_VALUE SPV -- unique key WHERE SPV.SPEC_PRPTY_VALUE_ID = SMPP.SPEC_PRPTY_VALUE AND SPV.SPEC_PRPTY_ID = SMPP.SPEC_PRPTY_ID) ,SMPP.SPEC_PRPTY_VALUE) INTO RESULT FROM SO_SUB_PROD_HIS SMP, SO_sub_PROD_PRPTY_HIS SMPP WHERE SMP.SO_NBR = LV_SO_NBR AND (SMP.NO_FLAG = 'A' OR (SMP.NO_FLAG = 'P' AND SMP.ACT_TYPE = 'R')) AND SMP.STS = 'A' AND SMPP.STS = 'A' AND SMPP.SO_SUB_PROD_ID = SMP.SO_SUB_PROD_ID AND SMPP.SPEC_PRPTY_ID = to_char(IP_SPEC_PRPTY_ID) and (smp.prod_id = ip_product_id or ip_product_id is null) AND ROWNUM = 1; EXCEPTION WHEN no_data_found THEN RETURN NULL; WHEN OTHERS THEN RETURN SQLERRM; END; END IF; RETURN(RESULT); END; /
use BIGGYM; drop function if exists strisnumeric; delimiter $$ create function strisnumeric (inputString varchar(1024)) returns boolean begin -- Configurable .. declare decimalPoint char(1) default '.'; declare powerOf char(1) default 'E'; declare regExpCharacters varchar(512) default '[.+.] [.-.]'; declare regExpClasses varchar(512) default '[:digit:]'; -- Initialise .. declare regExpAllowableFilter varchar(512) default concat('[ ', regExpClasses, regExpCharacters, '[.', decimalPoint, '.] [.', powerOf, '.] ]'); declare pos, stringLength smallint unsigned default 1; declare dpCount, poCount smallint unsigned default 0; declare c1 varchar(1); declare isNonNumeric boolean default false; set stringLength = char_length(trim(inputString)); -- Process .. if (inputString is NOT NULL and stringLength != 0) then repeat begin set c1 = mid(upper(inputString), pos, 1); -- Use regular expression character classes to filter allowable numeric characters .. if (not c1 regexp regExpAllowableFilter) then set isNonNumeric = true; end if; -- Specials at position 1 is a no ... if (((c1 = decimalPoint) or (c1 = powerOf)) and pos = 1) then set isNonNumeric = true; end if; -- Count specials .. if(c1 = decimalPoint) then set dpCount = dpCount + 1; end if; if(c1 = powerOf) then set poCount = poCount + 1; end if; set pos = pos + 1; end; until pos > stringLength end repeat; else set isNonNumeric = true; end if; -- Only allow 1 decimal point or 1 power of .... if(dpCount > 1 or poCount > 1) then set isNonNumeric = true; end if; -- Conclude .. if(isNonNumeric) then return false; else return true; end if; end $$ delimiter ;
-- Query 3: Top 10 bands SELECT a.Name AS ArtistName, COUNT(*) AS Songs FROM Artist a, Album ab, Track t, Genre g WHERE a.ArtistId = ab.ArtistId AND t.AlbumId = ab.AlbumId AND g.GenreId = t.GenreId AND g.Name = 'Rock' GROUP BY a.ArtistId ORDER BY Songs DESC LIMIT 10;
GRANT SELECT ON mailserver.* TO 'mailuser'@'127.0.0.1' IDENTIFIED BY 'mailuserpass'; FLUSH PRIVILEGES; CREATE TABLE `virtual_domains` ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `virtual_users` ( `id` int(11) NOT NULL auto_increment, `domain_id` int(11) NOT NULL, `password` varchar(106) NOT NULL, `email` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`), FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `virtual_aliases` ( `id` int(11) NOT NULL auto_increment, `domain_id` int(11) NOT NULL, `source` varchar(100) NOT NULL, `destination` varchar(100) NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `mailserver`.`virtual_domains` (`id` ,`name`) VALUES ('1', 'michielbdejong.com'); INSERT INTO `mailserver`.`virtual_users` (`id`, `domain_id`, `password` , `email`) VALUES ('1', '1', ENCRYPT('michielpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'anything@michielbdejong.com'); INSERT INTO `mailserver`.`virtual_aliases` (`id`, `domain_id`, `source`, `destination`) VALUES ('1', '1', '@michielbdejong.com', 'anything@michielbdejong.com');
CREATE TABLE IF NOT EXISTS service ( id VARCHAR(15) PRIMARY KEY, name VARCHAR(50), icon VARCHAR(50) ); INSERT INTO service (id, name, icon) VALUES ('SmkmtBhT', 'PDAM', 'water'), ('243LuSST', 'PLN', 'plug'), ('IPbGxZBz', 'Indihome', 'wifi'), ('glVzWtHr', 'First Media', 'wifi'), ('fRIvn-d5G', 'MNC', 'wifi')
Create Procedure mERP_SP_GetRecdDSTypelist AS Select ID from tbl_mERP_RecdDSTypeCGAbstract where IsNull(Status,0) = 0
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Apr 03, 2021 at 02:55 PM -- Server version: 10.4.17-MariaDB -- PHP Version: 7.4.14 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `kormoshala` -- -- -------------------------------------------------------- -- -- Table structure for table `corporate` -- CREATE TABLE `corporate` ( `Username` varchar(30) NOT NULL, `Email` varchar(40) NOT NULL, `Phone` varchar(11) NOT NULL, `CompanyName` varchar(20) NOT NULL, `CompanyAddress` varchar(50) NOT NULL, `TradeLicense` varchar(20) NOT NULL, `Password` varchar(30) NOT NULL, `Image` varchar(300) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `corporate` -- INSERT INTO `corporate` (`Username`, `Email`, `Phone`, `CompanyName`, `CompanyAddress`, `TradeLicense`, `Password`, `Image`) VALUES ('jahnnabi', 'jahnnabi.moni54@gmail.com', '01930284388', 'square', 'sfsgdg', '1234567890', '@1234567', '../uploads/received_188451681904970.jpeg'), ('kirty', 'shruto.kirty123@gmail.com', '01912243250', 'acme', 'road#12, house#20', '8739646384', '$1234567', '../uploads/received_167367570680048.jpeg'); -- -- Indexes for dumped tables -- -- -- Indexes for table `corporate` -- ALTER TABLE `corporate` ADD PRIMARY KEY (`Username`); 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 SEQUENCE points_id_seq INCREMENT BY 1 MINVALUE 1 START 1; CREATE TABLE points (id INT NOT NULL, text TEXT NOT NULL, tsvector TSVECTOR NOT NULL, geometry geometry(GEOMETRY, 0) NOT NULL, point geometry(POINT) NOT NULL, point_2d geometry(POINT, 3785) NOT NULL, point_3dz geometry(POINTZ, 3785) NOT NULL, point_3dm geometry(POINTM, 3785) NOT NULL, point_4d geometry(POINTZM, 3785) NOT NULL, point_2d_nullable geometry(POINT, 3785) DEFAULT NULL, point_2d_nosrid geometry(POINT) NOT NULL, geography geography(GEOMETRY, 4326) NOT NULL, point_geography_2d geography(POINT) NOT NULL, point_geography_2d_srid geography(POINT, 4326) NOT NULL, PRIMARY KEY(id)); CREATE INDEX idx_text ON points (text); CREATE INDEX idx_text_gist ON points USING gist(tsvector); CREATE INDEX IDX_27BA8E29B7A5F324 ON points USING GIST (point); CREATE INDEX IDX_27BA8E2999674A3D ON points USING GIST (point_2d); CREATE INDEX IDX_27BA8E293BE136C3 ON points USING GIST (point_3dz); CREATE INDEX IDX_27BA8E29B832B304 ON points USING GIST (point_3dm); CREATE INDEX IDX_27BA8E29CF3DEDBB ON points USING GIST (point_4d); CREATE INDEX IDX_27BA8E293C257075 ON points USING GIST (point_2d_nullable); CREATE INDEX IDX_27BA8E293D5FE69E ON points USING GIST (point_2d_nosrid); CREATE INDEX IDX_27BA8E295F51A43C ON points USING GIST (point_geography_2d); CREATE INDEX IDX_27BA8E295AFBB72D ON points USING GIST (point_geography_2d_srid); COMMENT ON TABLE points IS 'This is a comment for table points'; COMMENT ON COLUMN points.point IS 'This is a comment for column point';
SELECT * FROM Employees WHERE Employees.JobTitle = 'Sales Representative';
select pr.id, pr.event_id, pr.dup_created_at, pr.created_at, coalesce(pr.body, ''), pr.closed_at, pr.comments, pr.locked, pr.number, pr.state, pr.title, pr.updated_at, pr.base_sha, pr.head_sha, pr.merged_at, pr.merge_commit_sha, pr.merged, pr.mergeable, pr.rebaseable, pr.mergeable_state, pr.review_comments, pr.maintainer_can_modify, pr.commits, pr.additions, pr.deletions, pr.changed_files, pr.dup_type, pr.dup_repo_name, coalesce(r.org_login, ''), coalesce(r.repo_group, ''), coalesce(r.alias, ''), m.number, coalesce(m.state, ''), coalesce(m.title, ''), coalesce(pr.dupn_assignee_login, assignee.login, ''), coalesce(assignee.name, ''), coalesce(assignee.country_id, ''), coalesce(assignee.sex, ''), assignee.sex_prob, coalesce(assignee.tz, ''), assignee.tz_offset, coalesce(assignee.country_name, ''), coalesce(pr.dup_actor_login, actor.login, ''), coalesce(actor.name, ''), coalesce(actor.country_id, ''), coalesce(actor.sex, ''), actor.sex_prob, coalesce(actor.tz, ''), actor.tz_offset, coalesce(actor.country_name, ''), coalesce(pr.dup_user_login, usr.login, ''), coalesce(usr.name, ''), coalesce(usr.country_id, ''), coalesce(usr.sex, ''), usr.sex_prob, coalesce(usr.tz, ''), usr.tz_offset, coalesce(usr.country_name, ''), coalesce(pr.dupn_merged_by_login, merged_by.login, ''), coalesce(merged_by.name, ''), coalesce(merged_by.country_id, ''), coalesce(merged_by.sex, ''), merged_by.sex_prob, coalesce(merged_by.tz, ''), merged_by.tz_offset, coalesce(merged_by.country_name, ''), coalesce(assignee_aff.company_name, ''), coalesce(actor_aff.company_name, ''), coalesce(usr_aff.company_name, ''), coalesce(merged_by_aff.company_name, '') from gha_pull_requests pr left join gha_repos r on pr.dup_repo_id = r.id and pr.dup_repo_name = r.name left join gha_actors assignee on pr.assignee_id = assignee.id left join gha_actors actor on pr.dup_actor_id = actor.id left join gha_actors usr on pr.user_id = usr.id left join gha_actors merged_by on pr.merged_by_id = merged_by.id left join gha_milestones m on pr.milestone_id = m.id and pr.event_id = m.event_id left join gha_actors_affiliations assignee_aff on pr.assignee_id = assignee_aff.actor_id and assignee_aff.dt_from <= pr.dup_created_at and assignee_aff.dt_to > pr.dup_created_at left join gha_actors_affiliations actor_aff on pr.dup_actor_id = actor_aff.actor_id and actor_aff.dt_from <= pr.dup_created_at and actor_aff.dt_to > pr.dup_created_at left join gha_actors_affiliations usr_aff on pr.user_id = usr_aff.actor_id and usr_aff.dt_from <= pr.created_at and usr_aff.dt_to > pr.created_at left join gha_actors_affiliations merged_by_aff on pr.merged_by_id = merged_by_aff.actor_id and merged_by_aff.dt_from <= pr.merged_at and merged_by_aff.dt_to > pr.merged_at where pr.dup_created_at >= '{{from}}' and pr.dup_created_at < '{{to}}' ;
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 22, 2020 at 05:46 PM -- Server version: 10.1.30-MariaDB -- PHP Version: 5.6.33 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `venuefinder` -- -- -------------------------------------------------------- -- -- Table structure for table `book_venue` -- CREATE TABLE `book_venue` ( `book_id` bigint(20) UNSIGNED NOT NULL, `venue_id` int(11) NOT NULL, `event_name` varchar(100) NOT NULL, `user_id` int(11) NOT NULL, `booking_date` varchar(255) NOT NULL, `payment` varchar(255) NOT NULL, `transaction_id` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `book_venue` -- INSERT INTO `book_venue` (`book_id`, `venue_id`, `event_name`, `user_id`, `booking_date`, `payment`, `transaction_id`) VALUES (3, 9, 'vitthal Mangalam', 1, '2020-03-11', '', 0), (4, 9, 'vitthal Mangalam', 2, '2020-03-11', '', 0), (5, 14, 'ww', 2, '20-03-2019', 'Yes', 0); -- -------------------------------------------------------- -- -- Table structure for table `contact` -- CREATE TABLE `contact` ( `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, `phone` varchar(10) NOT NULL, `message` varchar(500) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `contact` -- INSERT INTO `contact` (`id`, `name`, `email`, `phone`, `message`, `date`) VALUES (1, 'bhagyashree', 'b18shinde@gmail.com', '7485968574', 'Good', '2020-02-06 12:18:37'), (2, 'w', 'w@GMAIL.COM', '1W', 'W', '2020-02-07 04:37:18'), (3, 'ajit', 'ajit@gmail.com', '7485968574', 'Good', '2020-02-07 04:54:08'); -- -------------------------------------------------------- -- -- Table structure for table `images` -- CREATE TABLE `images` ( `image_id` bigint(20) UNSIGNED NOT NULL, `holder_id` int(11) NOT NULL, `album_name` varchar(100) NOT NULL, `image_name` varchar(255) NOT NULL, `location` varchar(255) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `likes` int(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `images` -- INSERT INTO `images` (`image_id`, `holder_id`, `album_name`, `image_name`, `location`, `created_at`, `likes`) VALUES (1, 2, 'Sonam', 'image10.jpg', 'http://localhost/venuefinder/controller/uploads/image10.jpg', '2020-03-03 09:26:15', 0), (2, 2, 'Bhagi', 'image1.jpg', 'http://localhost/venuefinder/controller/uploads/image1.jpg', '2020-03-03 10:52:25', 0), (3, 2, 'Bhagi', 'image2.jpeg', 'http://localhost/venuefinder/controller/uploads/image2.jpeg', '2020-03-03 10:52:25', 0), (4, 2, 'Bhagi', 'image3.jpg', 'http://localhost/venuefinder/controller/uploads/image3.jpg', '2020-03-03 10:52:25', 0), (5, 2, 'Bhagi', 'image4.jpeg', 'http://localhost/venuefinder/controller/uploads/image4.jpeg', '2020-03-03 10:52:25', 0), (6, 2, 'Bhagi', 'image5.jpg', 'http://localhost/venuefinder/controller/uploads/image5.jpg', '2020-03-03 10:52:25', 0), (7, 2, 'Bhagi', 'image6.jpeg', 'http://localhost/venuefinder/controller/uploads/image6.jpeg', '2020-03-03 10:52:25', 0), (8, 2, 'Sonam', 'image7.jpg', 'http://localhost/venuefinder/controller/uploads/image7.jpg', '2020-03-03 10:52:25', 0), (9, 2, 'Sonam', 'image8.jpg', 'http://localhost/venuefinder/controller/uploads/image8.jpg', '2020-03-03 10:52:25', 0), (10, 2, 'sona', 'image1.jpg', 'http://localhost/venuefinder/controller/uploads/i', '2020-03-04 05:43:32', 0); -- -------------------------------------------------------- -- -- Table structure for table `notification` -- CREATE TABLE `notification` ( `notification_id` int(10) NOT NULL, `id` int(10) NOT NULL, `notification` varchar(100) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `register_user` -- CREATE TABLE `register_user` ( `user_id` int(20) UNSIGNED NOT NULL, `user_name` varchar(50) NOT NULL, `mobile` varchar(10) NOT NULL, `address` varchar(100) NOT NULL, `password` varchar(50) NOT NULL, `email` varchar(30) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `register_user` -- INSERT INTO `register_user` (`user_id`, `user_name`, `mobile`, `address`, `password`, `email`, `created_at`, `updated_at`) VALUES (1, 'Bhagyashree', '7219743775', 'satara', '202cb962ac59075b964b07152d234b70', '', '2020-03-21 03:38:22', '0000-00-00'), (2, 'Sonam', '8380905672', 'satara', '202cb962ac59075b964b07152d234b70', '', '2020-03-21 03:38:22', '0000-00-00'), (3, 'Shruti', '7485968574', 'satara', 'fcea920f7412b5da7be0cf42b8c93759', '', '2020-03-21 03:38:22', '0000-00-00'); -- -------------------------------------------------------- -- -- Table structure for table `register_venue` -- CREATE TABLE `register_venue` ( `user_id` bigint(20) UNSIGNED NOT NULL, `user_name` varchar(50) NOT NULL, `venue_name` varchar(100) NOT NULL, `city` varchar(30) NOT NULL DEFAULT 'Satara', `mobile` varchar(10) NOT NULL, `booking_amt` int(10) NOT NULL, `email` varchar(30) NOT NULL, `address` varchar(50) NOT NULL, `pincode` int(6) NOT NULL, `password` varchar(50) NOT NULL, `ac_type` varchar(20) NOT NULL DEFAULT 'Owner', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NULL DEFAULT NULL, `status` varchar(20) NOT NULL DEFAULT 'Deactive', `logo` varchar(255) NOT NULL, `banner_image` varchar(255) NOT NULL, `views` int(10) NOT NULL, `ip` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `register_venue` -- INSERT INTO `register_venue` (`user_id`, `user_name`, `venue_name`, `city`, `mobile`, `booking_amt`, `email`, `address`, `pincode`, `password`, `ac_type`, `created_at`, `updated_at`, `status`, `logo`, `banner_image`, `views`, `ip`) VALUES (1, 'Admin', 'Venue Finder', 'Satara', '4444444444', 0, '216326406', '1', 415502, '202cb962ac59075b964b07152d234b70', 'Admin', '2020-01-31 16:28:22', '2020-03-11 04:39:21', 'Active', 'Photo.jpg', 'Photo.jpg', 0, ''), (14, 'Sonam Ankush Bhosale', 'Priyanka Multipurpose Hall ', 'Satara', '1111111111', 65000, 'sonam1@gmail.com', 'Near to Narayan Barge Hospital ,MIDC Koragoan ', 415501, '22773e915dbf2fdc9b742e7e1d52b31f', 'Owner', '2020-03-10 03:07:35', '2020-03-18 22:30:47', 'Active', 'image2.jpeg', 'image1.jpg', 10, ''), (15, 'sonam', 'Fulai Mangal ', 'Satara', '1234567890', 20000, 'sonam@gmail.com', 'adsfsf', 415501, '22773e915dbf2fdc9b742e7e1d52b31f', 'Owner', '2020-03-14 16:51:37', NULL, 'Deactive', 'image1.jpg', 'image2.jpeg', 0, ''), (27, 'v', 'v', 'Satara', '1234565434', 1234, 'sonam23@gmail.com', 's', 123256, '22773e915dbf2fdc9b742e7e1d52b31f', 'Owner', '2020-03-15 07:16:12', NULL, 'Deactive', 'image1.jpg', 'image2.jpeg', 0, '::1'), (28, 'sona', 'sona', 'Satara', '1236789098', 12345, 'sp@gmail.com', 'Satara', 415501, '22773e915dbf2fdc9b742e7e1d52b31f', 'Owner', '2020-03-15 07:20:32', NULL, 'Deactive', 'image1.jpg', 'image2.jpeg', 0, '::1'); -- -------------------------------------------------------- -- -- Table structure for table `subscription_plan` -- CREATE TABLE `subscription_plan` ( `plan_id` bigint(20) UNSIGNED NOT NULL, `plan_name` varchar(30) NOT NULL, `plan_rate` int(10) NOT NULL, `subscription_type` varchar(30) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `subscription_plan` -- INSERT INTO `subscription_plan` (`plan_id`, `plan_name`, `plan_rate`, `subscription_type`, `created_at`, `updated_at`) VALUES (1, 'Silver', 100, 'Monthly', '2020-02-22 13:11:17', '0000-00-00 00:00:00'), (2, 'Gold', 100, 'Monthly', '2020-02-22 13:13:01', '0000-00-00 00:00:00'), (3, 'Platinum', 100, 'Monthly', '2020-02-22 13:13:01', '0000-00-00 00:00:00'), (4, 'Silver', 1200, 'Yearly', '2020-02-22 13:11:17', '0000-00-00 00:00:00'), (5, 'Gold', 1200, 'Yearly', '2020-02-22 13:13:01', '0000-00-00 00:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `venue_details` -- CREATE TABLE `venue_details` ( `venue_id` int(10) NOT NULL, `venue_info` varchar(300) NOT NULL, `chair` int(10) NOT NULL, `seating_capacity` int(10) NOT NULL, `room` int(10) NOT NULL, `parking` varchar(10) NOT NULL, `drink_water` varchar(10) NOT NULL, `catering` varchar(10) NOT NULL, `decoration` varchar(10) NOT NULL, `sound_system` varchar(10) NOT NULL, `ac_fan` varchar(10) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `venue_details` -- INSERT INTO `venue_details` (`venue_id`, `venue_info`, `chair`, `seating_capacity`, `room`, `parking`, `drink_water`, `catering`, `decoration`, `sound_system`, `ac_fan`, `created_at`, `updated_at`) VALUES (2, 'sonam', 10, 10, 3, 'Yes', 'Yes', 'Yes', 'Yes', 'Yes', 'Yes', '2020-03-15 05:40:59', '0000-00-00 00:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `venue_enquires` -- CREATE TABLE `venue_enquires` ( `id` bigint(20) UNSIGNED NOT NULL, `user_id` int(11) NOT NULL, `venue_id` int(11) NOT NULL, `event_name` varchar(100) NOT NULL, `booking_date` varchar(11) NOT NULL, `requirement` varchar(255) NOT NULL, `token` varchar(10) NOT NULL, `quotation_rate` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `venue_enquires` -- INSERT INTO `venue_enquires` (`id`, `user_id`, `venue_id`, `event_name`, `booking_date`, `requirement`, `token`, `quotation_rate`) VALUES (19, 1, 12, '', '2020-03-25', 'wedding hall with all facilities', 'G271paZs1b', 50000), (22, 2, 12, '', '2020-03-25', 'wedding hall with all facilities', 'G271paZs1b', 50000), (23, 2, 14, '', '2020-03-25', 'wedding hall with all facilities', 'G271paZs1b', 50000), (24, 1, 14, '', '2020-03-25', 'wedding hall with all facilities', 'G271paZs1b', 50000); -- -------------------------------------------------------- -- -- Table structure for table `venue_plan` -- CREATE TABLE `venue_plan` ( `id` bigint(20) UNSIGNED NOT NULL, `venue_id` int(11) NOT NULL, `plan_id` int(11) NOT NULL, `payment` int(11) NOT NULL, `status` varchar(255) NOT NULL, `start` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `end` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `venue_plan` -- INSERT INTO `venue_plan` (`id`, `venue_id`, `plan_id`, `payment`, `status`, `start`, `end`) VALUES (1, 9, 1, 100, 'Active', '2020-03-09 02:51:47', '0000-00-00 00:00:00'), (2, 10, 2, 50, 'Active', '2020-03-09 03:03:40', '0000-00-00 00:00:00'), (3, 11, 2, 50, 'Active', '2020-03-09 03:03:40', '0000-00-00 00:00:00'), (4, 12, 1, 100, 'Active', '2020-03-09 03:03:40', '0000-00-00 00:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `videos` -- CREATE TABLE `videos` ( `video_id` int(11) NOT NULL, `holder_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `description` varchar(255) NOT NULL, `extension` varchar(5) NOT NULL, `location` varchar(500) NOT NULL, `likes` int(4) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `videos` -- INSERT INTO `videos` (`video_id`, `holder_id`, `name`, `description`, `extension`, `location`, `likes`, `created_at`) VALUES (1, 2, 'Countdown - 7374.mp4', 'CountDown Video', 'mp4', 'http://localhost/venuefinder/videos/Countdown - 7374.mp4', 5, '2020-02-06 14:38:39'), (3, 5, 'healthy.mp4', 's', 'mp4', 'http://localhost/venuefinder/videos/healthy.mp4', 2, '2020-02-26 06:05:32'), (4, 2, 'healthy.mp4', 'New Latest Video', 'mp4', 'http://localhost/venuefinder/videos/healthy.mp4', 2, '2020-03-03 11:37:16'); -- -- Indexes for dumped tables -- -- -- Indexes for table `book_venue` -- ALTER TABLE `book_venue` ADD UNIQUE KEY `id` (`book_id`); -- -- Indexes for table `contact` -- ALTER TABLE `contact` ADD UNIQUE KEY `id` (`id`); -- -- Indexes for table `images` -- ALTER TABLE `images` ADD UNIQUE KEY `image_id` (`image_id`); -- -- Indexes for table `notification` -- ALTER TABLE `notification` ADD PRIMARY KEY (`notification_id`); -- -- Indexes for table `register_user` -- ALTER TABLE `register_user` ADD PRIMARY KEY (`user_id`); -- -- Indexes for table `register_venue` -- ALTER TABLE `register_venue` ADD UNIQUE KEY `user_id` (`user_id`), ADD UNIQUE KEY `mobile` (`mobile`), ADD UNIQUE KEY `email` (`email`); -- -- Indexes for table `subscription_plan` -- ALTER TABLE `subscription_plan` ADD UNIQUE KEY `plan_id` (`plan_id`); -- -- Indexes for table `venue_details` -- ALTER TABLE `venue_details` ADD UNIQUE KEY `venue_id` (`venue_id`); -- -- Indexes for table `venue_enquires` -- ALTER TABLE `venue_enquires` ADD UNIQUE KEY `id` (`id`); -- -- Indexes for table `venue_plan` -- ALTER TABLE `venue_plan` ADD UNIQUE KEY `book_id` (`id`); -- -- Indexes for table `videos` -- ALTER TABLE `videos` ADD PRIMARY KEY (`video_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `book_venue` -- ALTER TABLE `book_venue` MODIFY `book_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `contact` -- ALTER TABLE `contact` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `images` -- ALTER TABLE `images` MODIFY `image_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT for table `notification` -- ALTER TABLE `notification` MODIFY `notification_id` int(10) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `register_user` -- ALTER TABLE `register_user` MODIFY `user_id` int(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `register_venue` -- ALTER TABLE `register_venue` MODIFY `user_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT for table `subscription_plan` -- ALTER TABLE `subscription_plan` MODIFY `plan_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `venue_enquires` -- ALTER TABLE `venue_enquires` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; -- -- AUTO_INCREMENT for table `venue_plan` -- ALTER TABLE `venue_plan` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `videos` -- ALTER TABLE `videos` MODIFY `video_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- Aug 9, 2009 11:49:40 AM EEST -- BF [2834402] - Wrong Reference type for Partner Category column UPDATE AD_Column SET AD_Reference_ID=10,Updated=TO_TIMESTAMP('2009-08-09 11:49:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2710 ;
ALTER TABLE trading ADD COLUMN clean_address VARCHAR(100) NULL;
(SELECT submissions.submission_date, submissions.member_id, members.name, submissions.score FROM submissions JOIN members ON submissions.member_id = members.id WHERE score = (SELECT max(score) FROM submissions) AND submission_date = '2018-01-01' LIMIT 1) union (SELECT submissions.submission_date, submissions.member_id, members.name, submissions.score FROM submissions JOIN members ON submissions.member_id = members.id WHERE score = (SELECT max(score) FROM submissions WHERE member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' ) AND submission_date = '2018-01-02') AND member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' ) AND submission_date = '2018-01-02' LIMIT 1) union (SELECT submissions.submission_date, submissions.member_id, members.name, submissions.score FROM submissions JOIN members ON submissions.member_id = members.id WHERE score = (SELECT max(score) FROM submissions WHERE member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' intersect SELECT member_id from submissions where submission_date='2018-01-03' ) AND submission_date = '2018-01-03') AND member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' intersect SELECT member_id from submissions where submission_date='2018-01-03' ) AND submission_date = '2018-01-03' LIMIT 1) union (SELECT submissions.submission_date, submissions.member_id, members.name, submissions.score FROM submissions JOIN members ON submissions.member_id = members.id WHERE score = (SELECT max(score) FROM submissions WHERE member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' intersect SELECT member_id from submissions where submission_date='2018-01-03' intersect SELECT member_id from submissions where submission_date='2018-01-04' ) AND submission_date = '2018-01-04') AND member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' intersect SELECT member_id from submissions where submission_date='2018-01-03' intersect SELECT member_id from submissions where submission_date='2018-01-04' ) AND submission_date='2018-01-04' LIMIT 1) union (SELECT submissions.submission_date, submissions.member_id, members.name, submissions.score FROM submissions JOIN members ON submissions.member_id = members.id WHERE score = (SELECT max(score) FROM submissions WHERE member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' intersect SELECT member_id from submissions where submission_date='2018-01-03' intersect SELECT member_id from submissions where submission_date='2018-01-04' intersect SELECT member_id from submissions where submission_date='2018-01-05' ) AND submission_date = '2018-01-05') AND member_id IN ( SELECT member_id from submissions where submission_date='2018-01-01' intersect SELECT member_id from submissions where submission_date='2018-01-02' intersect SELECT member_id from submissions where submission_date='2018-01-03' intersect SELECT member_id from submissions where submission_date='2018-01-04' intersect SELECT member_id from submissions where submission_date='2018-01-05' ) AND submission_date = '2018-01-05' LIMIT 1) ;
SELECT TOP(5) k.CountryName AS Country, ISNULL(k.PeakName, '(no highest peak)') AS [Highest Peak Name], ISNULL(k.Elevation,0) AS [Highest Peak Elevation], ISNULL(k.MountainRange,'(no mountain)') AS [Mountain] FROM ( SELECT c.CountryName, p.PeakName, p.Elevation, m.MountainRange, DENSE_RANK() OVER (PARTITION BY c.CountryName ORDER BY p.Elevation DESC) AS Ranked FROM Countries c LEFT JOIN MountainsCountries mc ON mc.CountryCode=c.CountryCode LEFT JOIN Mountains m ON m.Id=mc.MountainId LEFT JOIN Peaks p ON p.MountainId=m.Id ) AS k WHERE k.Ranked=1 ORDER BY k.CountryName
ALTER TABLE `ucpaas_message_stats_4.4`.`t_sms_client_indexes_stat_0` CHANGE COLUMN `order_delay_num_1` `order_delay_num_1` INT(11) NULL DEFAULT '0' COMMENT '订单延时0-1秒(包括0s和1s)' , CHANGE COLUMN `order_delay_num_2` `order_delay_num_2` INT(11) NULL DEFAULT '0' COMMENT '订单延时1-3秒(不包括1s,包括3s)' , CHANGE COLUMN `order_delay_num_3` `order_delay_num_3` INT(11) NULL DEFAULT '0' COMMENT '订单延时3-5秒(不包括3s,包括5s)' ;
IF (db_id(N'BlogDb') IS NULL) CREATE DATABASE BlogDb ELSE BEGIN ALTER DATABASE BlogDb SET single_user WITH ROLLBACK IMMEDIATE DROP DATABASE BlogDb CREATE DATABASE BlogDb END
INSERT INTO FILMLAND_USERS VALUES('testuser1@sogeti.com', '$2a$10$AjHGc4x3Nez/p4ZpvFDWeO6FGxee/cVqj5KHHnHfuLnIOzC5ag4fm'); INSERT INTO FILMLAND_USERS VALUES('java@sogeti.com', '$2a$10$SLBA1yOqic8k4qFRxbKdl.AjLV3dU4LcAaLtL6o4tH.ffF4KJ1MhS'); INSERT INTO FILMLAND_USERS VALUES('testuser2@sogeti.com', '$2a$10$jCB1RhrG/U454Bvlo.aiFOu58chAXowAy8jkUn1Bi3ixSPGR49SFy'); INSERT INTO FILMLAND_USERS VALUES('testuser3@sogeti.com', '$2a$10$fGd4PFW39W9zYcYYSb9ZI.wqmJsrP6cy4tvpO/792yZ7fmT4r0q0W'); INSERT INTO AVAILABLE_CATEGORIES VALUES('Dutch Films','4','10'); INSERT INTO AVAILABLE_CATEGORIES VALUES('Dutch Series','20','6'); INSERT INTO AVAILABLE_CATEGORIES VALUES('International Films','5','8'); INSERT INTO USER_SUBSCRIBED_CATEGORIES VALUES('101','testuser1@sogeti.com','International Films','5','2019-03-20','10','N','Y'); INSERT INTO USER_SUBSCRIBED_CATEGORIES VALUES('102','testuser2@sogeti.com','Dutch Films','2','2019-01-20','6','Y','N'); INSERT INTO USER_SUBSCRIBED_CATEGORIES VALUES('103','testuser3@sogeti.com','International Films','5','2019-03-01','10','N','Y');
CREATE TABLE IF NOT EXISTS department ( id SERIAL NOT NULL PRIMARY KEY, name_department VARCHAR(255) NOT NULL UNIQUE ); CREATE TABLE IF NOT EXISTS employee( id SERIAL NOT NULL PRIMARY KEY, department_id INT, first_name VARCHAR(50) NOT NULL, last_name VARCHAR(100) NOT NULL, age INT NOT NULL, email VARCHAR(255) NOT NULL UNIQUE, date BIGINT, FOREIGN KEY (department_id) REFERENCES department(id) );
SET SQL_SAFE_UPDATES = 0; # Admin user id conflict fix # ------------------------------------------------------------ SET @david_user_id := (select id from person where username = 'david.warner@gmail.com'); DELETE FROM `synapse`.`organization_role` WHERE `person_id`=@david_user_id and organization_id='-1'; DELETE FROM `synapse`.`person_contact_info` WHERE `person_id`=@david_user_id; DELETE FROM `synapse`.`AccessToken` WHERE `user_id`=@david_user_id; DELETE FROM `synapse`.`RefreshToken` WHERE `user_id`=@david_user_id; DELETE FROM `synapse`.`person` WHERE `username`='david.warner@gmail.com'; DELETE FROM `synapse`.`Client` where `random_id` = '14tx5vbsnois4ggg0ok0c4gog8kg0ww488gwkg88044cog4884'; DELETE FROM `synapse`.`contact_info` WHERE `primary_email`='david.warner@gmail.com'; /* * Include refresh_token as additional grant_type */ UPDATE `synapse`.`Client` SET `allowed_grant_types`='a:2:{i:0;s:8:\"password\";i:1;s:13:\"refresh_token\";}' WHERE `random_id`='382nwsdkpl44gs84s448w8g00s4okkksc880og40wgkswcgw0s'; /* Person david.warner@gmail.com/Mapworks Admin record to be created */ INSERT INTO `Client` (`random_id`,`redirect_uris`,`secret`,`allowed_grant_types`) VALUES ('14tx5vbsnois4ggg0ok0c4gog8kg0ww488gwkg88044cog4884','a:0:{}','4v5p8idswhs0404owsws48gwwccc4wksw4c8s80wcocwskockg','a:2:{i:0;s:8:\"password\";i:1;s:13:\"refresh_token\";}'); INSERT INTO `person` (`created_by`,`created_at`,`modified_by`,`modified_at`,`deleted_by`,`deleted_at`,`firstname`,`lastname`,`title`,`date_of_birth`,`external_id`,`username`,`password`,`activation_token`,`confidentiality_stmt_accept_date`,`organization_id`,`token_expiry_date`,`welcome_email_sent_date`,`risk_level`,`risk_update_date`,`intent_to_leave`,`intent_to_leave_update_date`,`last_contact_date`,`last_activity`,`record_type`) VALUES (NULL,NULL,NULL,NULL,NULL,NULL,'David','Warner',NULL,NULL,'David123','david.warner@gmail.com','$2y$13$f6bnaUYhaIO0qzJ0krqrIeUDnxJxWYYEyB3L6qDDK/1ln5CsHKEca',NULL,NULL,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); SET @roleId := (select role_id from role_lang where role_name = 'Mapworks Admin'); SET @personId := (select id from person where username = 'david.warner@gmail.com'); SET @orgId := (select organization_id from person where username = 'david.warner@gmail.com'); INSERT INTO `organization_role` (`role_id`,`person_id`,`organization_id`,`created_by`,`created_at`,`modified_by`,`modified_at`,`deleted_by`,`deleted_at`) VALUES (@roleId,@personId,-1,NULL,NULL,NULL,NULL,NULL,NULL); INSERT INTO `contact_info` (`address_1`,`address_2`,`city`,`zip`,`state`,`country`,`primary_mobile`,`alternate_mobile`,`home_phone`,`office_phone`,`primary_email`,`alternate_email`,`primary_mobile_provider`,`alternate_mobile_provider`,`created_by`,`created_at`,`modified_by`,`modified_at`,`deleted_by`,`deleted_at`) VALUES (NULL,NULL,NULL,NULL,NULL,NULL,'9591900663',NULL,NULL,NULL,'david.warner@gmail.com',NULL,'9224852114',NULL,NULL,NULL,NULL,'2014-10-15 12:34:01',NULL,NULL); SET @contactId := (select max(id) from contact_info); INSERT INTO `person_contact_info` (`person_id`,`contact_id`,`status`,`created_by`,`modified_by`,`deleted_by`,`created_at`,`modified_at`,`deleted_at`) VALUES (@personId,@contactId,'A',NULL,NULL,NULL,NULL,NULL,NULL);
-- 用户表 create table ${SCHEMA}.iam_user ( id bigint not null, tenant_id bigint not null default 0, org_id bigint not null default 0, user_num varchar(20) not null, realname varchar(50) not null, gender varchar(10) not null, birthdate date null, mobile_phone varchar(20) null, email varchar(50) null, avatar_url varchar(200) null, status varchar(10) not null default 'A', is_deleted tinyint not null DEFAULT 0, create_time datetime not null default CURRENT_TIMESTAMP, update_time datetime null default CURRENT_TIMESTAMP, constraint PK_iam_user primary key (id) ); -- 添加备注 execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'组织ID', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'org_id'; execute sp_addextendedproperty 'MS_Description', N'用户编号', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'user_num'; execute sp_addextendedproperty 'MS_Description', N'真实姓名', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'realname'; execute sp_addextendedproperty 'MS_Description', N'性别', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'gender'; execute sp_addextendedproperty 'MS_Description', N'出生日期', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'birthdate'; execute sp_addextendedproperty 'MS_Description', N'手机号', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'mobile_phone'; execute sp_addextendedproperty 'MS_Description', N'Email', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'email'; execute sp_addextendedproperty 'MS_Description', N'头像', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'avatar_url'; execute sp_addextendedproperty 'MS_Description', N'状态', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'status'; execute sp_addextendedproperty 'MS_Description', N'删除标记', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_user, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'系统用户', 'SCHEMA', '${SCHEMA}', 'table', iam_user, null, null; -- 索引 create nonclustered index idx_iam_user_1 on iam_user (org_id); create nonclustered index idx_iam_user_2 on iam_user (mobile_phone); create nonclustered index idx_iam_user_num on iam_user (user_num); create nonclustered index idx_iam_user_tenant on iam_user(tenant_id); -- 账号表 create table ${SCHEMA}.iam_account ( id bigint not null, tenant_id bigint not null default 0, user_type varchar(100) default 'IamUser' not null, user_id bigint not null, auth_type varchar(20) default 'PWD' not null, auth_account varchar(100) not null, auth_secret varchar(100) null, secret_salt varchar(32) null, status varchar(10) default 'A' not null, is_deleted tinyint default 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, update_time datetime null default CURRENT_TIMESTAMP, constraint PK_iam_account primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'用户类型', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'user_type'; execute sp_addextendedproperty 'MS_Description', N'用户ID', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'user_id'; execute sp_addextendedproperty 'MS_Description', N'认证方式', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'auth_type'; execute sp_addextendedproperty 'MS_Description', N'用户名', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'auth_account'; execute sp_addextendedproperty 'MS_Description', N'密码', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'auth_secret'; execute sp_addextendedproperty 'MS_Description', N'加密盐', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'secret_salt'; execute sp_addextendedproperty 'MS_Description', N'用户状态', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'status'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_account, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'登录账号', 'SCHEMA', '${SCHEMA}', 'table', iam_account, null, null; -- 创建索引 create index idx_iam_account on iam_account(auth_account, auth_type, user_type); create nonclustered index idx_iam_account_tenant on iam_account(tenant_id); -- 角色表 create table ${SCHEMA}.iam_role ( id bigint not null, tenant_id bigint not null default 0, name varchar(50) not null, code varchar(50) not null, description varchar(100) null, is_deleted tinyint default 0 not null, create_time datetime default CURRENT_TIMESTAMP null, update_time datetime null default CURRENT_TIMESTAMP, constraint PK_iam_role primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'名称', 'SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'name'; execute sp_addextendedproperty 'MS_Description', N'编码', 'SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'code'; execute sp_addextendedproperty 'MS_Description', N'备注', 'SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'description'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_role, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'角色', 'SCHEMA', '${SCHEMA}', 'table', iam_role, null, null; -- 创建索引 create nonclustered index idx_iam_role_tenant on iam_role(tenant_id); -- 用户角色表 create table ${SCHEMA}.iam_user_role ( id bigint identity, tenant_id bigint not null default 0, user_type varchar(100) default 'IamUser' not null, user_id bigint not null, role_id bigint not null, is_deleted tinyint default 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, update_time datetime null default CURRENT_TIMESTAMP, constraint PK_iam_user_role primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'用户类型', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'user_type'; execute sp_addextendedproperty 'MS_Description', N'用户ID', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'user_id'; execute sp_addextendedproperty 'MS_Description', N'角色ID', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'role_id'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'用户角色关联', 'SCHEMA', '${SCHEMA}', 'table', iam_user_role, null, null; -- 索引 create nonclustered index idx_iam_user_role on iam_user_role (user_type, user_id); create nonclustered index idx_iam_user_role_tenant on iam_user_role(tenant_id); -- 资源权限表 create table ${SCHEMA}.iam_resource_permission ( id bigint identity, tenant_id bigint not null default 0, app_module varchar(50), parent_id bigint default 0 not null, display_type varchar(20) not null, display_name varchar(100) not null, resource_code varchar(100) null, permission_code varchar(200) null, sort_id bigint null, is_deleted tinyint default 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, update_time datetime default CURRENT_TIMESTAMP null, constraint PK_iam_resource_permission primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'应用模块','SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'app_module'; execute sp_addextendedproperty 'MS_Description', N'父资源ID', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'parent_id'; execute sp_addextendedproperty 'MS_Description', N'展现类型', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'display_type'; execute sp_addextendedproperty 'MS_Description', N'显示名称', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'display_name'; execute sp_addextendedproperty 'MS_Description', N'前端编码', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'resource_code'; execute sp_addextendedproperty 'MS_Description', N'权限码', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'permission_code'; execute sp_addextendedproperty 'MS_Description', N'排序号', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'sort_id'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'资源权限表', 'SCHEMA', '${SCHEMA}', 'table', iam_resource_permission, null, null; -- 索引 create nonclustered index idx_iam_resource_permission on iam_resource_permission (parent_id); create nonclustered index idx_resource_permission_tenant on iam_resource_permission(tenant_id); -- 角色-权限 create table ${SCHEMA}.iam_role_resource ( id bigint identity , tenant_id bigint not null default 0, role_id bigint not null , resource_id bigint not null , is_deleted tinyint default 0 not null , create_time datetime default CURRENT_TIMESTAMP not null, constraint PK_iam_role_resource primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_role_resource, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_role_resource, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'角色ID', 'SCHEMA', '${SCHEMA}', 'table', iam_role_resource, 'column', 'role_id'; execute sp_addextendedproperty 'MS_Description', N'资源ID', 'SCHEMA', '${SCHEMA}', 'table', iam_role_resource, 'column', 'resource_id'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_role_resource, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_role_resource, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'角色资源', 'SCHEMA', '${SCHEMA}', 'table', iam_role_resource, null, null; -- 索引 create nonclustered index idx_iam_role_resource on iam_role_resource (role_id, resource_id); create nonclustered index idx_iam_role_resource_tenant on iam_role_resource(tenant_id); -- 登录日志表 create table ${SCHEMA}.iam_login_trace ( id bigint identity , tenant_id bigint not null default 0, user_type varchar(100) default 'IamUser' not null , user_id bigint not null , auth_type varchar(20) default 'PWD' not null , auth_account varchar(100) not null , ip_address varchar(50) null , user_agent varchar(200) null , is_success tinyint default 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, constraint PK_iam_login_trace primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'用户类型', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'user_type'; execute sp_addextendedproperty 'MS_Description', N'用户ID', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'user_id'; execute sp_addextendedproperty 'MS_Description', N'认证方式', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'auth_type'; execute sp_addextendedproperty 'MS_Description', N'用户名', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'auth_account'; execute sp_addextendedproperty 'MS_Description', N'IP', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'ip_address'; execute sp_addextendedproperty 'MS_Description', N'客户端信息', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'user_agent'; execute sp_addextendedproperty 'MS_Description', N'是否成功', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'is_success'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'登录日志', 'SCHEMA', '${SCHEMA}', 'table', iam_login_trace, null, null; -- 创建索引 create nonclustered index idx_iam_login_trace on iam_login_trace (user_type, user_id); create nonclustered index idx_iam_login_trace_2 on iam_login_trace (auth_account); create nonclustered index idx_iam_login_trace_tenant on iam_login_trace(tenant_id); -- 操作日志表 create table ${SCHEMA}.iam_operation_log ( id bigint identity , tenant_id bigint not null default 0, app_module varchar(50), business_obj varchar(100) not null, operation varchar(100) not null, user_type varchar(100) default 'IamUser' not null , user_id bigint not null , user_realname varchar(100) null, request_uri varchar(500) not null, request_method varchar(20) not null, request_params varchar(1000) null, request_ip varchar(50) null, status_code smallint default 0 not null, error_msg varchar(1000) null, is_deleted tinyint default 0 not null , create_time datetime default CURRENT_TIMESTAMP not null, constraint PK_iam_operation_log primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'应用模块','SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'app_module'; execute sp_addextendedproperty 'MS_Description', N'业务对象', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'business_obj'; execute sp_addextendedproperty 'MS_Description', N'操作描述', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'operation'; execute sp_addextendedproperty 'MS_Description', N'用户类型', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'user_type'; execute sp_addextendedproperty 'MS_Description', N'用户ID', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'user_id'; execute sp_addextendedproperty 'MS_Description', N'用户姓名', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'user_realname'; execute sp_addextendedproperty 'MS_Description', N'请求URI', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_uri'; execute sp_addextendedproperty 'MS_Description', N'请求方式', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_method'; execute sp_addextendedproperty 'MS_Description', N'请求参数', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_params'; execute sp_addextendedproperty 'MS_Description', N'IP', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'request_ip'; execute sp_addextendedproperty 'MS_Description', N'状态码', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'status_code'; execute sp_addextendedproperty 'MS_Description', N'异常信息', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'error_msg'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'操作日志', 'SCHEMA', '${SCHEMA}', 'table', iam_operation_log, null, null; -- 创建索引 create nonclustered index idx_iam_operation_log on iam_operation_log (user_type, user_id); create nonclustered index idx_iam_operation_log_tenant on iam_operation_log(tenant_id); -- 部门表 CREATE TABLE ${SCHEMA}.iam_org ( id bigint not null, tenant_id bigint default 0 not null, parent_id bigint DEFAULT 0 NOT NULL, top_org_id bigint DEFAULT 0 NOT NULL, name varchar(100) NOT NULL, short_name varchar(50) NOT NULL, type varchar(100) DEFAULT 'DEPT' NOT NULL, code varchar(50) NOT NULL, manager_id bigint DEFAULT 0 NOT NULL, depth smallint DEFAULT 1 NOT NULL, sort_id bigint DEFAULT 1 NOT NULL, status varchar(10) DEFAULT 'A' NOT NULL, org_comment varchar(255) null, is_deleted tinyint DEFAULT 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, update_time datetime null default CURRENT_TIMESTAMP, constraint PK_iam_org primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'上级ID','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'parent_id'; execute sp_addextendedproperty 'MS_Description', N'企业ID','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'top_org_id'; execute sp_addextendedproperty 'MS_Description', N'名称','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'name'; execute sp_addextendedproperty 'MS_Description', N'简称','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'short_name'; execute sp_addextendedproperty 'MS_Description', N'类型','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'type'; execute sp_addextendedproperty 'MS_Description', N'编码','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'code'; execute sp_addextendedproperty 'MS_Description', N'负责人','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'manager_id'; execute sp_addextendedproperty 'MS_Description', N'层级','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'depth'; execute sp_addextendedproperty 'MS_Description', N'排序号','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'sort_id'; execute sp_addextendedproperty 'MS_Description', N'状态','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'status'; execute sp_addextendedproperty 'MS_Description', N'备注','SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'org_comment'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_org, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'部门', 'SCHEMA', '${SCHEMA}', 'table', iam_org, null, null; -- 创建索引 create nonclustered index idx_iam_org on iam_org (parent_id); create nonclustered index idx_iam_org_tenant on iam_org (tenant_id); -- 岗位 create table ${SCHEMA}.iam_position ( id bigint not null, tenant_id bigint default 0 not null, name varchar(100) not null, code varchar(50) not null, is_virtual tinyint default 0 not null, grade_name varchar(50) null, grade_value varchar(30) default '0' null, data_permission_type varchar(20) default 'SELF' null, is_deleted tinyint DEFAULT 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, update_time datetime null default CURRENT_TIMESTAMP, constraint PK_iam_position primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'名称','SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'name'; execute sp_addextendedproperty 'MS_Description', N'编码','SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'code'; execute sp_addextendedproperty 'MS_Description', N'是否虚拟岗','SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'is_virtual'; execute sp_addextendedproperty 'MS_Description', N'职级头衔','SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'grade_name'; execute sp_addextendedproperty 'MS_Description', N'职级','SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'grade_value'; execute sp_addextendedproperty 'MS_Description', N'数据权限类型','SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'data_permission_type'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_position, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'岗位', 'SCHEMA', '${SCHEMA}', 'table', iam_position, null, null; -- 创建索引 create nonclustered index idx_iam_position on iam_position (code); create nonclustered index idx_iam_position_tenant on iam_position (tenant_id); -- 用户岗位 create table iam_user_position ( id bigint identity, tenant_id bigint default 0 not null, user_type varchar(100) default 'IamUser' not null, user_id bigint not null, org_id bigint default 0 not null, position_id bigint not null, is_primary_position tinyint default 1 not null, is_deleted tinyint DEFAULT 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, update_time datetime default CURRENT_TIMESTAMP null, constraint PK_iam_user_position primary key (id) ); execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'用户类型','SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'user_type'; execute sp_addextendedproperty 'MS_Description', N'用户ID','SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'user_id'; execute sp_addextendedproperty 'MS_Description', N'组织ID','SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'org_id'; execute sp_addextendedproperty 'MS_Description', N'岗位ID','SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'position_id'; execute sp_addextendedproperty 'MS_Description', N'是否主岗','SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'is_primary_position'; execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_user_position, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'用户岗位关联', 'SCHEMA', '${SCHEMA}', 'table', iam_user_position, null, null; -- 创建索引 create nonclustered index idx_iam_user_position on iam_user_position (user_type, user_id); create nonclustered index idx_iam_user_position_pos on iam_user_position (position_id); -- 系统配置表 create table ${SCHEMA}.system_config ( id bigint identity, tenant_id bigint not null default 0, type varchar(50) not null, prop varchar(50) not null, value varchar(255) null, is_deleted tinyint not null default 0, create_time datetime not null default CURRENT_TIMESTAMP, update_time datetime null default CURRENT_TIMESTAMP, constraint PK_system_config primary key (id) ); -- 添加备注 execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'id'; execute sp_addextendedproperty 'MS_Description', N'租户ID','SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'tenant_id'; execute sp_addextendedproperty 'MS_Description', N'类型','SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'type'; execute sp_addextendedproperty 'MS_Description', N'属性','SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'prop'; execute sp_addextendedproperty 'MS_Description', N'属性值','SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'value'; execute sp_addextendedproperty 'MS_Description', N'删除标记','SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'is_deleted'; execute sp_addextendedproperty 'MS_Description', N'创建时间','SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'create_time'; execute sp_addextendedproperty 'MS_Description', N'更新时间','SCHEMA', '${SCHEMA}', 'table', system_config, 'column', 'update_time'; execute sp_addextendedproperty 'MS_Description', N'系统配置','SCHEMA', '${SCHEMA}', 'table', system_config, null, null; -- 创建索引 create nonclustered index idx_system_config on ${SCHEMA}.system_config(type, prop); create nonclustered index idx_system_config_tenant on ${SCHEMA}.system_config(tenant_id);
--PL/SQL Variables Declaration[ anonymous block] DECLARE v_first_name VARCHAR2 (20); v_last_name VARCHAR2 (20); n_employee_id NUMBER; d_hire_date DATE; BEGIN NULL; END; --PL/SQL variable anchors DECLARE v_first_name EMPLOYEES.FIRST_NAME%TYPE; v_last_name EMPLOYEES.LAST_NAME%TYPE; n_employee_id EMPLOYEES.EMPLOYEE_ID%TYPE; d_hire_date EMPLOYEES.HIRE_DATE%TYPE; BEGIN NULL; END; --PL/SQL variable assignment DECLARE n_employee_id EMPLOYEES.EMPLOYEE_ID%TYPE := 200; d_hire_date EMPLOYEES.HIRE_DATE%TYPE := '03-02-1991'; BEGIN NULL; END; -------------------------------------------------------- DECLARE v_first_name EMPLOYEES.FIRST_NAME%TYPE; v_last_name EMPLOYEES.LAST_NAME%TYPE; n_employee_id EMPLOYEES.EMPLOYEE_ID%TYPE; d_hire_date EMPLOYEES.HIRE_DATE%TYPE; BEGIN v_first_name := 'Mary'; v_last_name := 'Jane'; d_hire_date := '03-02-1991'; END; ---------------------------------------------------- DECLARE v_first_name EMPLOYEES.FIRST_NAME%TYPE; v_last_name EMPLOYEES.LAST_NAME%TYPE; n_employee_id EMPLOYEES.EMPLOYEE_ID%TYPE; d_hire_date EMPLOYEES.HIRE_DATE%TYPE; BEGIN SELECT employee_id, first_name, last_name, hire_date INTO n_employee_id, v_first_name, v_last_name, d_hire_date FROM employees WHERE employee_id = 200; DBMS_OUTPUT.PUT_LINE (v_first_name); DBMS_OUTPUT.PUT_LINE (v_last_name); DBMS_OUTPUT.PUT_LINE (d_hire_date); END;
create table visitantes ( id serial, quantidade integer default 0 not null, constraint visitantes_id_pk primary key (id) ); insert into visitantes values (1, 0);
-- phpMyAdmin SQL Dump -- version 4.0.10.10 -- http://www.phpmyadmin.net -- -- Хост: 127.0.0.1:3306 -- Время создания: Мар 01 2016 г., 15:10 -- Версия сервера: 5.5.45 -- Версия PHP: 5.5.28 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- База данных: `articles` -- -- -------------------------------------------------------- -- -- Структура таблицы `article` -- CREATE TABLE IF NOT EXISTS `article` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(100) COLLATE utf8_bin NOT NULL, `date` date NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_2` (`id`), KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=42 ; -- -- Дамп данных таблицы `article` -- INSERT INTO `article` (`id`, `name`, `date`) VALUES (1, 'Книга 33', '2016-02-09'), (7, 'Книга 4', '2016-02-16'), (8, 'Белочка пришла', '2016-02-16'), (13, 'cat', '2011-11-11'), (14, 'cat', '2011-11-11'), (15, 'cat', '2011-11-11'), (16, 'cat', '2011-11-11'), (19, 'cat', '2011-11-11'), (32, 'dog', '2022-11-12'), (34, 'dogs', '2022-11-14'), (35, '212adsadsa', '2011-11-11'), (36, 'Проверка', '2011-11-11'), (37, 'sadasd', '2011-11-11'), (38, '22wewqewqe', '2011-11-11'), (39, '2212', '2022-11-21'), (40, 'Статья', '2022-11-21'), (41, 'Проверка еще', '2016-03-24'); -- -------------------------------------------------------- -- -- Структура таблицы `autor` -- CREATE TABLE IF NOT EXISTS `autor` ( `id_autor` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(40) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id_autor`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=100 ; -- -- Дамп данных таблицы `autor` -- INSERT INTO `autor` (`id_autor`, `name`) VALUES (1, 'Вася'), (2, 'Петя'), (3, 'Дима'), (4, 'Коля'), (5, 'autor0'), (6, 'autor1'), (7, 'autor2'), (8, 'autor3'), (9, 'autor4'), (10, 'autor5'), (11, 'autor6'), (12, 'autor7'), (13, 'autor8'), (14, 'autor9'), (15, 'autor10'), (16, 'autor11'), (17, 'autor12'), (18, 'autor13'), (19, 'autor14'), (20, 'autor15'), (21, 'autor16'), (22, 'autor17'), (23, 'autor18'), (24, 'autor19'), (25, 'autor20'), (26, 'autor21'), (27, 'autor22'), (28, 'autor23'), (29, 'autor24'), (30, 'autor25'), (31, 'autor26'), (32, 'autor27'), (33, 'autor28'), (34, 'autor29'), (35, 'autor30'), (36, 'autor31'), (37, 'autor32'), (38, 'autor33'), (39, 'autor34'), (40, 'autor35'), (41, 'autor36'), (42, 'autor37'), (43, 'autor38'), (44, 'autor39'), (45, 'autor40'), (46, 'autor41'), (47, 'autor42'), (48, 'autor43'), (49, 'autor44'), (50, 'autor45'), (51, 'autor46'), (52, 'autor47'), (53, 'autor48'), (54, 'autor49'), (55, 'autor50'), (56, 'autor51'), (57, 'autor52'), (58, 'autor53'), (59, 'autor54'), (60, 'autor55'), (61, 'autor56'), (62, 'autor57'), (63, 'autor58'), (64, 'autor59'), (65, 'autor60'), (66, 'autor61'), (67, 'autor62'), (68, 'autor63'), (69, 'autor64'), (70, 'autor65'), (71, 'autor66'), (72, 'autor67'), (73, 'autor68'), (74, 'autor69'), (75, 'autor70'), (76, 'autor71'), (77, 'autor72'), (78, 'autor73'), (79, 'autor74'), (80, 'autor75'), (81, 'autor76'), (82, 'autor77'), (83, 'autor78'), (84, 'autor79'), (85, 'autor80'), (86, 'autor81'), (87, 'autor82'), (88, 'autor83'), (89, 'autor84'), (90, 'autor85'), (91, 'autor86'), (92, 'autor87'), (93, 'autor88'), (94, 'autor89'), (95, 'autor90'), (96, 'autor91'), (97, 'autor92'), (98, 'autor93'), (99, 'autor94'); -- -------------------------------------------------------- -- -- Структура таблицы `temp` -- CREATE TABLE IF NOT EXISTS `temp` ( `id_article` bigint(20) NOT NULL, `id_autor` int(11) NOT NULL, KEY `id_article` (`id_article`), KEY `id_autor` (`id_autor`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -- Дамп данных таблицы `temp` -- INSERT INTO `temp` (`id_article`, `id_autor`) VALUES (1, 2), (7, 5), (34, 3), (34, 2), (34, 1), (36, 2), (36, 3), (37, 2), (37, 3), (38, 1), (38, 2), (38, 3), (39, 2), (39, 3), (40, 2), (40, 3), (41, 3), (41, 31); -- -- Ограничения внешнего ключа сохраненных таблиц -- -- -- Ограничения внешнего ключа таблицы `temp` -- ALTER TABLE `temp` ADD CONSTRAINT `temp_ibfk_1` FOREIGN KEY (`id_article`) REFERENCES `article` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
create table if not exists empresas ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, nome VARCHAR(255) NOT NULL, cnpj int UNSIGNED, PRIMARY KEY (id), UNIQUE KEY (cnpj) ); drop table empresas_unidades; create table if not exists empresas_unidades ( id_cidade int unsigned not null, id_empresa int unsigned not null, sede TINYINT(1) NOT NULL, PRIMARY KEY (id_cidade, id_empresa) );
drop keyspace if exists "chat"; create keyspace "chat" with replication = { 'class': 'SimpleStrategy', 'replication_factor': 1 }; create table "chat"."chat_messages" ( userId1 text, userId2 text, createdAt bigint, message_json blob, PRIMARY KEY ((userId1, userId2), createdAt) ) with clustering order by (createdAt desc); create table "chat"."existing_chats" ( userId1 text, userId2 text, createdAt bigint, chat_data_json blob, PRIMARY KEY ((userId1, userId2), createdAt) ) with clustering order by (createdAt desc); create table "chat"."existing_chats_for_user" ( userId text, createdAt bigint, chat_data_json blob, PRIMARY KEY (userId, createdAt) ) with clustering order by (createdAt desc);
/* Name: Listing Views By MG - Last 7 Days Data source: 4 Created By: Admin Last Update At: 2015-08-19T13:54:05.023226+00:00 */ SELECT marketingGroup, COUNT(*) AS Views ,COUNT(DISTINCT post_visid_high + "-" + post_visid_low + "-" + visit_num) Visits ,COUNT(DISTINCT post_visid_high + "-" + post_visid_low) Visitors FROM (SELECT MG_H.marketingGroup_name AS marketingGroup, post_visid_high, post_visid_low, visit_num FROM (SELECT NTH(1, SPLIT(post_prop7, '_')) AS agentId, post_visid_high, post_visid_low, visit_num FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal, "table_id CONTAINS '2015_' AND length(table_id) >= 4 AND year(TIMESTAMP(CONCAT(REPLACE(table_id,"_","-"),"-01"))) = year(CURRENT_DATE()) and month(TIMESTAMP(CONCAT(REPLACE(table_id,"_","-"),"-01"))) in (month(CURRENT_DATE()),(month(CURRENT_DATE())-1))")) WHERE post_page_event = "0" /*condition indicated by kevin chen*/ AND date(date_time) >= date(DATE_ADD(CURRENT_TIMESTAMP(), -7, "DAY")) /*Just Last 7 days*/ AND post_prop19 = 'listing' /* Counting Listings */ ) a JOIN (SELECT string(id) as id from [djomniture:devspark.MG_All_Listings]) AS L ON a.Listing = L.id /*Join to select just VALID ListingID*/ JOIN [djomniture:devspark.MG_Hierarchy] AS MG_H ON a.agentId = MG_H.agent_id ) GROUP BY marketingGroup ORDER BY 1
USE doggo_calendar; INSERT INTO Parks (name, lat, lon, createdAt, updatedAt) VALUES ("Zilker Park", 30.1549, 97.4636, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), ("Hemisfair Park", 29.4198, 98.4866, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); INSERT INTO Users (email, password, name, profileImage, createdAt, updatedAt) VALUES ("dawso.andrew@gmail.com", "$2a$10$hUin0YPkLkKwpqoyw.rptum5iT.1iZE.qCOMzReeGfkzFOKJ6Uize", "Andrew", "https://s3.amazonaws.com/dogs-day-out/3amNcNZotSaqYay5DXXsZ.jpg", CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); INSERT INTO Dogs (name, gender, bio, weight, energy, patience, dominance, profileImage, UserId, createdAt, updatedAt) VALUES ("Chucho", "Male", "Raddest doggo around", 70, 3, 6, 2, "https://s3.amazonaws.com/dogs-day-out/5QKB6V1J1x2mA4emOhwPI.jpg", 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
create or replace package github_issues_events as /** Interface to Github issues events API * @author Morten Egan (github.com/morten-egan) * @project OracleGit * @version 0.1.0 */ /** List events for an issue * @author Morten Egan * @param git_account The account that owns the repository * @param repos_name The name of the repository * @param issue_number The id of the issue * @return The JSON data on all events for specified issue */ function list_issue_events ( git_account varchar2 , repos_name varchar2 , issue_number number ) return github.call_result; /** List events for a repository * @author Morten Egan * @param git_account The account that owns the repository * @param repos_name The name of the repository * @return The JSON data on all events for specified repository */ function list_repos_events ( git_account varchar2 , repos_name varchar2 ) return github.call_result; /** Get single event * @author Morten Egan * @param git_account The account that owns the repository * @param repos_name The name of the repository * @param event_id The id of the event to fetch * @return The JSON data for that specific event */ function get_event ( git_account varchar2 , repos_name varchar2 , event_id number ) return github.call_result; end github_issues_events; /
-- +migrate Up insert into oauth_clients (id, user_id, name, secret, scopes, redirect, revoked, created_at, updated_at) values ('a9832dab-598c-11ea-a5a2-0242c0a8a000', '8d42ee3e-5717-4b65-b0b6-218361f981b3', 'Aplicativo 1', '8zd9ULma6xNN1wbR7h8er7z7qbERULsjCqD2pzT5', 'user:read,user:write,user:delete', 'https://webhook.site/365c600d-ce97-471a-805e-6076eef7f9aa', false, NOW(), NOW()); insert into oauth_clients (id, user_id, name, secret, scopes, redirect, revoked, created_at, updated_at) values ('a9832dab-598c-11ea-a5a2-0242c0a8a001', '8d42ee3e-5717-4b65-b0b6-218361f981b3', 'Aplicativo 2', '8zd9ULma6xNN1wbR7h8er7z7qbERULsjCqD2pzT1', 'user:read,user:write,user:delete', 'http://localhost:4200/app/#/auth/callback', false, NOW(), NOW()); insert into oauth_clients (id, user_id, name, secret, scopes, redirect, revoked, created_at, updated_at) values ('a9832dab-598c-11ea-a5a2-0242c0a8a002', '8d42ee3e-5717-4b65-b0b6-218361f981b3', 'Aplicativo 3', '8zd9ULma6xNN1wbR7h8er7z7qbERULsjCqD2pzT1', 'user:read,user:write,user:delete', 'http://localhost:9099/app/#/auth/callback', false, NOW(), NOW()); -- +migrate Down delete from oauth_refresh_tokens; delete from oauth_access_tokens; delete from oauth_auth_codes; delete from oauth_clients;
-- -- PostgreSQL database dump -- -- Dumped from database version 9.4.1 -- Dumped by pg_dump version 9.4.1 -- Started on 2015-04-06 20:53:14 SET statement_timeout = 0; SET lock_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; -- -- TOC entry 2086 (class 1262 OID 12135) -- Dependencies: 2085 -- Name: postgres; Type: COMMENT; Schema: -; Owner: postgres -- COMMENT ON DATABASE postgres IS 'default administrative connection database'; -- -- TOC entry 187 (class 3079 OID 11855) -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; -- -- TOC entry 2089 (class 0 OID 0) -- Dependencies: 187 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; -- -- TOC entry 186 (class 3079 OID 16384) -- Name: adminpack; Type: EXTENSION; Schema: -; Owner: -- CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog; -- -- TOC entry 2090 (class 0 OID 0) -- Dependencies: 186 -- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner: -- COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL'; SET search_path = public, pg_catalog; SET default_tablespace = ''; SET default_with_oids = false; -- -- TOC entry 172 (class 1259 OID 16829) -- Name: adressen; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE adressen ( addr_id integer NOT NULL, strasse character varying(30) NOT NULL, plz integer NOT NULL, ort character varying(30) NOT NULL, hausnummer integer ); ALTER TABLE adressen OWNER TO postgres; -- -- TOC entry 185 (class 1259 OID 16943) -- Name: allerg_prod; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE allerg_prod ( fk_kuerzel character varying(5) NOT NULL, fk_produkt_id integer NOT NULL ); ALTER TABLE allerg_prod OWNER TO postgres; -- -- TOC entry 184 (class 1259 OID 16927) -- Name: allergene; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE allergene ( kuerzel character varying(5) NOT NULL, bezeichnung character varying(30) NOT NULL ); ALTER TABLE allergene OWNER TO postgres; -- -- TOC entry 178 (class 1259 OID 16870) -- Name: filialen; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE filialen ( f_id integer NOT NULL, uid integer, name character varying(30) NOT NULL, telefon integer, fax integer, geschlossen boolean NOT NULL, fk_addr_id integer NOT NULL ); ALTER TABLE filialen OWNER TO postgres; -- -- TOC entry 177 (class 1259 OID 16868) -- Name: filialen_f_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE filialen_f_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE filialen_f_id_seq OWNER TO postgres; -- -- TOC entry 2091 (class 0 OID 0) -- Dependencies: 177 -- Name: filialen_f_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE filialen_f_id_seq OWNED BY filialen.f_id; -- -- TOC entry 176 (class 1259 OID 16858) -- Name: kunden; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE kunden ( fk_pers_id integer NOT NULL ); ALTER TABLE kunden OWNER TO postgres; -- -- TOC entry 175 (class 1259 OID 16848) -- Name: mitarbeiter; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE mitarbeiter ( fk_pers_id integer NOT NULL, eintrittsdatum date NOT NULL, austrittsdatum date ); ALTER TABLE mitarbeiter OWNER TO postgres; -- -- TOC entry 174 (class 1259 OID 16836) -- Name: personen; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE personen ( pers_id integer NOT NULL, vorname character varying(30), nachname character varying(30), geschlecht character(1), fk_addr_id integer, CONSTRAINT personen_geschlecht_check CHECK (((geschlecht = 'm'::bpchar) OR (geschlecht = 'w'::bpchar))) ); ALTER TABLE personen OWNER TO postgres; -- -- TOC entry 173 (class 1259 OID 16834) -- Name: personen_pers_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE personen_pers_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE personen_pers_id_seq OWNER TO postgres; -- -- TOC entry 2092 (class 0 OID 0) -- Dependencies: 173 -- Name: personen_pers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE personen_pers_id_seq OWNED BY personen.pers_id; -- -- TOC entry 181 (class 1259 OID 16904) -- Name: produkte; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE produkte ( produkt_id integer NOT NULL, name character varying(30) NOT NULL, preis integer NOT NULL, mwst integer NOT NULL, ausgelaufen boolean NOT NULL ); ALTER TABLE produkte OWNER TO postgres; -- -- TOC entry 183 (class 1259 OID 16911) -- Name: rechn_prod; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE rechn_prod ( id integer NOT NULL, preis integer NOT NULL, mwst integer NOT NULL, fk_prod_id integer, fk_rechn_nr integer NOT NULL ); ALTER TABLE rechn_prod OWNER TO postgres; -- -- TOC entry 182 (class 1259 OID 16909) -- Name: rechn_prod_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE rechn_prod_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE rechn_prod_id_seq OWNER TO postgres; -- -- TOC entry 2093 (class 0 OID 0) -- Dependencies: 182 -- Name: rechn_prod_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE rechn_prod_id_seq OWNED BY rechn_prod.id; -- -- TOC entry 180 (class 1259 OID 16883) -- Name: rechnungen; Type: TABLE; Schema: public; Owner: postgres; Tablespace: -- CREATE TABLE rechnungen ( rechn_nr integer NOT NULL, datum date NOT NULL, uhrzeit time without time zone NOT NULL, fk_f_id integer NOT NULL, fk_kunden_pers_id integer, fk_mitarbeiter_pers_id integer ); ALTER TABLE rechnungen OWNER TO postgres; -- -- TOC entry 179 (class 1259 OID 16881) -- Name: rechnungen_rechn_nr_seq; Type: SEQUENCE; Schema: public; Owner: postgres -- CREATE SEQUENCE rechnungen_rechn_nr_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ALTER TABLE rechnungen_rechn_nr_seq OWNER TO postgres; -- -- TOC entry 2094 (class 0 OID 0) -- Dependencies: 179 -- Name: rechnungen_rechn_nr_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres -- ALTER SEQUENCE rechnungen_rechn_nr_seq OWNED BY rechnungen.rechn_nr; -- -- TOC entry 1926 (class 2604 OID 16873) -- Name: f_id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY filialen ALTER COLUMN f_id SET DEFAULT nextval('filialen_f_id_seq'::regclass); -- -- TOC entry 1924 (class 2604 OID 16839) -- Name: pers_id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY personen ALTER COLUMN pers_id SET DEFAULT nextval('personen_pers_id_seq'::regclass); -- -- TOC entry 1928 (class 2604 OID 16914) -- Name: id; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY rechn_prod ALTER COLUMN id SET DEFAULT nextval('rechn_prod_id_seq'::regclass); -- -- TOC entry 1927 (class 2604 OID 16886) -- Name: rechn_nr; Type: DEFAULT; Schema: public; Owner: postgres -- ALTER TABLE ONLY rechnungen ALTER COLUMN rechn_nr SET DEFAULT nextval('rechnungen_rechn_nr_seq'::regclass); -- -- TOC entry 2067 (class 0 OID 16829) -- Dependencies: 172 -- Data for Name: adressen; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY adressen (addr_id, strasse, plz, ort, hausnummer) FROM stdin; 1 Maurerstrasse 1100 Wien 10 2 Steinerweg 1230 Wien 9 3 Vorderbach 6680 Salzburg 11 \. -- -- TOC entry 2080 (class 0 OID 16943) -- Dependencies: 185 -- Data for Name: allerg_prod; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY allerg_prod (fk_kuerzel, fk_produkt_id) FROM stdin; \. -- -- TOC entry 2079 (class 0 OID 16927) -- Dependencies: 184 -- Data for Name: allergene; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY allergene (kuerzel, bezeichnung) FROM stdin; AA Amalgam AB Amybo AC Acombo BC Bocudo CC Coco \. -- -- TOC entry 2073 (class 0 OID 16870) -- Dependencies: 178 -- Data for Name: filialen; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY filialen (f_id, uid, name, telefon, fax, geschlossen, fk_addr_id) FROM stdin; 1 1 Restaurant A1 \N \N f 1 2 2 Restaurant A3 \N \N f 2 3 3 Restaurant A6 \N \N t 3 \. -- -- TOC entry 2095 (class 0 OID 0) -- Dependencies: 177 -- Name: filialen_f_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('filialen_f_id_seq', 1, false); -- -- TOC entry 2071 (class 0 OID 16858) -- Dependencies: 176 -- Data for Name: kunden; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY kunden (fk_pers_id) FROM stdin; 1 2 3 4 5 6 7 8 9 10 11 \. -- -- TOC entry 2070 (class 0 OID 16848) -- Dependencies: 175 -- Data for Name: mitarbeiter; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY mitarbeiter (fk_pers_id, eintrittsdatum, austrittsdatum) FROM stdin; 11 2001-01-01 \N 12 2004-05-01 \N 13 2007-06-06 \N 14 2008-08-06 \N 15 2014-09-09 \N 16 2015-02-10 \N \. -- -- TOC entry 2069 (class 0 OID 16836) -- Dependencies: 174 -- Data for Name: personen; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY personen (pers_id, vorname, nachname, geschlecht, fk_addr_id) FROM stdin; 1 Josef Maier m \N 2 Klaus Steiner m \N 3 Maria Wachter w \N 4 Michael Gruenigen m \N 5 Andrea Wagner w \N 6 Anita Kogler w \N 7 Vaclav Wrzykov m \N 8 Jurij Khalakhan m \N 9 Viktor Putin m \N 10 Janine Dorfer w \N 11 Katharina Galler w \N 12 Hermann Brunner m \N 13 Ladislav Kovacevic m \N 14 Ching Hue-Chong m \N 15 Ling-Ling Hong w \N 16 Martin Koner m \N 17 Andre Schuerrle m \N \. -- -- TOC entry 2096 (class 0 OID 0) -- Dependencies: 173 -- Name: personen_pers_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('personen_pers_id_seq', 1, false); -- -- TOC entry 2076 (class 0 OID 16904) -- Dependencies: 181 -- Data for Name: produkte; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY produkte (produkt_id, name, preis, mwst, ausgelaufen) FROM stdin; 1 Schweinsbraten 10 15 t 2 Pilzsuppe 5 15 f 3 Mousse au Chocolat 7 15 f 4 Veggie Burger 100 15 t 5 Pommes 3 15 t 6 Currywurst 6 15 f 7 Bier 3 10 f 8 Wein 4 10 t 9 Schnaps 4 10 f 10 Limo 5 10 f \. -- -- TOC entry 2078 (class 0 OID 16911) -- Dependencies: 183 -- Data for Name: rechn_prod; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY rechn_prod (id, preis, mwst, fk_prod_id, fk_rechn_nr) FROM stdin; 1 1 15 5 1 2 15 15 4 5 \. -- -- TOC entry 2097 (class 0 OID 0) -- Dependencies: 182 -- Name: rechn_prod_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('rechn_prod_id_seq', 1, false); -- -- TOC entry 2075 (class 0 OID 16883) -- Dependencies: 180 -- Data for Name: rechnungen; Type: TABLE DATA; Schema: public; Owner: postgres -- COPY rechnungen (rechn_nr, datum, uhrzeit, fk_f_id, fk_kunden_pers_id, fk_mitarbeiter_pers_id) FROM stdin; 1 2013-01-01 14:35:00 1 1 11 2 2013-02-01 13:33:00 1 2 11 3 2012-06-01 14:44:00 2 3 15 4 2010-08-07 12:22:00 2 2 15 5 2011-08-09 13:33:00 2 4 14 6 2014-02-28 18:20:13 3 9 13 7 2014-12-20 23:49:00 3 8 13 8 2008-10-10 01:35:33 3 7 14 9 2015-04-28 22:35:04 3 10 15 10 2015-01-01 04:19:59 3 10 15 11 2004-10-24 03:30:33 1 3 12 12 2003-01-01 04:04:33 3 4 14 13 2001-03-06 16:01:00 2 5 13 14 2008-02-27 01:01:01 2 2 14 15 2015-03-16 15:30:05 1 8 11 \. -- -- TOC entry 2098 (class 0 OID 0) -- Dependencies: 179 -- Name: rechnungen_rechn_nr_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- SELECT pg_catalog.setval('rechnungen_rechn_nr_seq', 1, false); -- -- TOC entry 1930 (class 2606 OID 16833) -- Name: adressen_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY adressen ADD CONSTRAINT adressen_pkey PRIMARY KEY (addr_id); -- -- TOC entry 1946 (class 2606 OID 16931) -- Name: allergene_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY allergene ADD CONSTRAINT allergene_pkey PRIMARY KEY (kuerzel); -- -- TOC entry 1938 (class 2606 OID 16875) -- Name: filialen_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY filialen ADD CONSTRAINT filialen_pkey PRIMARY KEY (f_id); -- -- TOC entry 1936 (class 2606 OID 16862) -- Name: kunden_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY kunden ADD CONSTRAINT kunden_pkey PRIMARY KEY (fk_pers_id); -- -- TOC entry 1934 (class 2606 OID 16852) -- Name: mitarbeiter_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY mitarbeiter ADD CONSTRAINT mitarbeiter_pkey PRIMARY KEY (fk_pers_id); -- -- TOC entry 1932 (class 2606 OID 16842) -- Name: personen_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY personen ADD CONSTRAINT personen_pkey PRIMARY KEY (pers_id); -- -- TOC entry 1942 (class 2606 OID 16908) -- Name: produkte_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY produkte ADD CONSTRAINT produkte_pkey PRIMARY KEY (produkt_id); -- -- TOC entry 1944 (class 2606 OID 16916) -- Name: rechn_prod_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY rechn_prod ADD CONSTRAINT rechn_prod_pkey PRIMARY KEY (id); -- -- TOC entry 1940 (class 2606 OID 16888) -- Name: rechnungen_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: -- ALTER TABLE ONLY rechnungen ADD CONSTRAINT rechnungen_pkey PRIMARY KEY (rechn_nr); -- -- TOC entry 1956 (class 2606 OID 16946) -- Name: allerg_prod_fk_kuerzel_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY allerg_prod ADD CONSTRAINT allerg_prod_fk_kuerzel_fkey FOREIGN KEY (fk_kuerzel) REFERENCES allergene(kuerzel); -- -- TOC entry 1957 (class 2606 OID 16951) -- Name: allerg_prod_fk_produkt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY allerg_prod ADD CONSTRAINT allerg_prod_fk_produkt_id_fkey FOREIGN KEY (fk_produkt_id) REFERENCES produkte(produkt_id); -- -- TOC entry 1950 (class 2606 OID 16876) -- Name: filialen_fk_addr_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY filialen ADD CONSTRAINT filialen_fk_addr_id_fkey FOREIGN KEY (fk_addr_id) REFERENCES adressen(addr_id); -- -- TOC entry 1949 (class 2606 OID 16863) -- Name: kunden_fk_pers_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY kunden ADD CONSTRAINT kunden_fk_pers_id_fkey FOREIGN KEY (fk_pers_id) REFERENCES personen(pers_id); -- -- TOC entry 1948 (class 2606 OID 16853) -- Name: mitarbeiter_fk_pers_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY mitarbeiter ADD CONSTRAINT mitarbeiter_fk_pers_id_fkey FOREIGN KEY (fk_pers_id) REFERENCES personen(pers_id); -- -- TOC entry 1947 (class 2606 OID 16843) -- Name: personen_fk_addr_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY personen ADD CONSTRAINT personen_fk_addr_id_fkey FOREIGN KEY (fk_addr_id) REFERENCES adressen(addr_id); -- -- TOC entry 1954 (class 2606 OID 16917) -- Name: rechn_prod_fk_prod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY rechn_prod ADD CONSTRAINT rechn_prod_fk_prod_id_fkey FOREIGN KEY (fk_prod_id) REFERENCES produkte(produkt_id); -- -- TOC entry 1955 (class 2606 OID 16922) -- Name: rechn_prod_fk_rechn_nr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY rechn_prod ADD CONSTRAINT rechn_prod_fk_rechn_nr_fkey FOREIGN KEY (fk_rechn_nr) REFERENCES rechnungen(rechn_nr); -- -- TOC entry 1951 (class 2606 OID 16889) -- Name: rechnungen_fk_f_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY rechnungen ADD CONSTRAINT rechnungen_fk_f_id_fkey FOREIGN KEY (fk_f_id) REFERENCES filialen(f_id); -- -- TOC entry 1952 (class 2606 OID 16894) -- Name: rechnungen_fk_kunden_pers_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY rechnungen ADD CONSTRAINT rechnungen_fk_kunden_pers_id_fkey FOREIGN KEY (fk_kunden_pers_id) REFERENCES kunden(fk_pers_id); -- -- TOC entry 1953 (class 2606 OID 16899) -- Name: rechnungen_fk_mitarbeiter_pers_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres -- ALTER TABLE ONLY rechnungen ADD CONSTRAINT rechnungen_fk_mitarbeiter_pers_id_fkey FOREIGN KEY (fk_mitarbeiter_pers_id) REFERENCES mitarbeiter(fk_pers_id); -- -- TOC entry 2088 (class 0 OID 0) -- Dependencies: 5 -- Name: public; Type: ACL; Schema: -; Owner: postgres -- REVOKE ALL ON SCHEMA public FROM PUBLIC; REVOKE ALL ON SCHEMA public FROM postgres; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO PUBLIC; -- Completed on 2015-04-06 20:53:14 -- -- PostgreSQL database dump complete --
# patch_52_53_i.sql # # title: probe PRIMARY KEY # # description: # Alter primary key to enable probes of same name but different array_chip i.e. Illumina ALTER table probe add UNIQUE KEY `tmp_primary` (`probe_id`,`name`, `array_chip_id`); ALTER table probe drop primary key; ALTER table probe add PRIMARY KEY (`probe_id`,`name`, `array_chip_id`); ALTER table probe drop key `tmp_primary`; # patch identifier INSERT INTO meta (species_id, meta_key, meta_value) VALUES (NULL, 'patch', 'patch_52_53_i.sql|probe PRIMARY KEY');
-- phpMyAdmin SQL Dump -- version 4.6.4 -- https://www.phpmyadmin.net/ -- -- Máy chủ: 127.0.0.1 -- Thời gian đã tạo: Th9 01, 2017 lúc 04:30 SA -- Phiên bản máy phục vụ: 5.7.14 -- Phiên bản PHP: 5.6.25 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 */; -- -- Cơ sở dữ liệu: `shishimai` -- -- -------------------------------------------------------- -- -- Cấu trúc bảng cho bảng `ssm_kpi_ga_months` -- CREATE TABLE `ssm_kpi_ga_months` ( `ssm_kpi_ga_month_id` int(11) NOT NULL, `year` int(4) NOT NULL, `month` int(2) NOT NULL, `transactionRevenue` int(11) NOT NULL DEFAULT '0' COMMENT '売上', `pageviews` int(11) NOT NULL DEFAULT '0' COMMENT 'PV数', `pageviewsPerSession` decimal(4,2) DEFAULT NULL, `sessions` int(11) NOT NULL DEFAULT '0' COMMENT 'セッション数', `avgSessionDuration` int(11) NOT NULL DEFAULT '0' COMMENT '平均セッション時間', `uniqueUsers` int(11) NOT NULL DEFAULT '0' COMMENT 'UU', `transactions` int(11) NOT NULL DEFAULT '0', `transactionsPerSession` decimal(4,2) DEFAULT NULL, `revenuePerTransaction` int(11) NOT NULL DEFAULT '0' COMMENT '客単価', `bounceRate` decimal(4,2) DEFAULT NULL, `topBounceRate` decimal(4,2) DEFAULT NULL, `site_id` int(11) NOT NULL, `created_user_id` int(11) NOT NULL, `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Đang đổ dữ liệu cho bảng `ssm_kpi_ga_months` -- INSERT INTO `ssm_kpi_ga_months` (`ssm_kpi_ga_month_id`, `year`, `month`, `transactionRevenue`, `pageviews`, `pageviewsPerSession`, `sessions`, `avgSessionDuration`, `uniqueUsers`, `transactions`, `transactionsPerSession`, `revenuePerTransaction`, `bounceRate`, `topBounceRate`, `site_id`, `created_user_id`, `created_at`, `updated_at`) VALUES (3, 2017, 7, 1718048, 93187, '2.34', 39864, 88, 34663, 84, '0.21', 20453, '62.15', '42.78', 1, 0, '2017-08-24 09:15:24', '0000-00-00 00:00:00'), (4, 2017, 6, 1619083, 92060, '2.40', 38311, 90, 32959, 81, '0.21', 19989, '60.75', '41.61', 1, 0, '2017-08-24 09:32:49', '0000-00-00 00:00:00'), (5, 2016, 7, 4300962, 170181, '2.86', 59575, 111, 48129, 204, '0.34', 21083, '49.00', '35.01', 1, 0, '2017-08-24 09:32:50', '0000-00-00 00:00:00'), (6, 2017, 1, 3671754, 222572, '2.80', 79555, 112, 68250, 176, '0.22', 20862, '53.39', '35.74', 1, 0, '2017-08-25 08:17:23', '0000-00-00 00:00:00'), (7, 2016, 2, 5254867, 208627, '2.70', 77140, 108, 59902, 265, '0.34', 19830, '54.69', '36.97', 1, 0, '2017-08-25 08:17:24', '0000-00-00 00:00:00'), (8, 2018, 1, 0, 0, '0.00', 0, 0, 0, 0, NULL, 0, NULL, NULL, 1, 0, '2017-08-25 08:45:04', '0000-00-00 00:00:00'), (9, 2017, 2, 3040362, 191242, '2.73', 70157, 106, 60442, 153, '0.22', 19872, '54.98', '36.68', 1, 0, '2017-08-25 08:45:05', '0000-00-00 00:00:00'), (10, 2016, 1, 6598258, 407478, '3.34', 122001, 117, 95241, 338, '0.28', 19521, '43.44', '29.94', 1, 0, '2017-08-29 09:16:02', '0000-00-00 00:00:00'), (11, 2017, 3, 2735299, 166903, '2.54', 65695, 99, 58126, 135, '0.21', 20261, '58.64', '39.36', 1, 0, '2017-08-29 09:16:08', '0000-00-00 00:00:00'), (12, 2016, 3, 5675423, 217375, '2.68', 81106, 108, 63612, 283, '0.35', 20054, '54.64', '37.31', 1, 0, '2017-08-29 09:16:08', '0000-00-00 00:00:00'), (13, 2017, 4, 2462772, 123564, '2.65', 46697, 102, 40863, 119, '0.25', 20696, '55.32', '37.79', 1, 0, '2017-08-29 09:16:12', '0000-00-00 00:00:00'), (14, 2016, 4, 5573617, 190811, '2.58', 73879, 104, 56766, 273, '0.37', 20416, '55.51', '38.72', 1, 0, '2017-08-29 09:16:13', '0000-00-00 00:00:00'), (15, 2017, 5, 2099359, 107383, '2.51', 42815, 93, 37144, 106, '0.25', 19805, '58.08', '39.87', 1, 0, '2017-08-29 09:16:20', '0000-00-00 00:00:00'), (16, 2016, 5, 4922955, 188624, '2.63', 71829, 101, 55004, 236, '0.33', 20860, '55.20', '38.08', 1, 0, '2017-08-29 09:16:21', '0000-00-00 00:00:00'), (17, 2017, 8, 1926799, 96510, '2.25', 42984, 80, 38127, 91, '0.21', 21174, '64.71', '44.54', 1, 0, '2017-09-01 02:05:55', '0000-00-00 00:00:00'), (18, 2016, 8, 3671758, 188014, '2.76', 68221, 103, 55427, 182, '0.27', 20174, '50.10', '36.28', 1, 0, '2017-09-01 02:15:37', '0000-00-00 00:00:00'); -- -- Chỉ mục cho các bảng đã đổ -- -- -- Chỉ mục cho bảng `ssm_kpi_ga_months` -- ALTER TABLE `ssm_kpi_ga_months` ADD PRIMARY KEY (`ssm_kpi_ga_month_id`); -- -- AUTO_INCREMENT cho các bảng đã đổ -- -- -- AUTO_INCREMENT cho bảng `ssm_kpi_ga_months` -- ALTER TABLE `ssm_kpi_ga_months` MODIFY `ssm_kpi_ga_month_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19; /*!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 */;
USE maltec_db; -- CATEGORIAS: INSERT INTO categorias (categoria, descricao) VALUES ("Perifericos", "Acessorios de computador perifericos"); INSERT INTO categorias (categoria, descricao) VALUES ("Processadores", "Processadores para maquinas"); INSERT INTO categorias (categoria, descricao) VALUES ("Placas de Video", "Placas de Video para maquinas"); INSERT INTO categorias (categoria, descricao) VALUES ("Monitores", "Monitores para computadores"); -- PRODUTOS: INSERT INTO produtos (produto, valor, categoria) VALUES ("Mouse Gamer Logitech G403", 199, 1); INSERT INTO produtos (produto, valor, categoria) VALUES ("Mouse Bungee GFallen", 149, 1); INSERT INTO produtos (produto, valor, categoria) VALUES ("Mousepad HyperX Fury P", 69, 1); INSERT INTO produtos (produto, valor, categoria) VALUES ("Processador Intel Core i5 9400F", 899, 2); INSERT INTO produtos (produto, valor, categoria) VALUES ("Processador AMD Ryzen 5 1600", 729, 2); INSERT INTO produtos (produto, valor, categoria) VALUES ("Processador Intel Core i7", 1599, 2); INSERT INTO produtos (produto, valor, categoria) VALUES ("Gigabyte AMD Radeon RX580 8GB", 899, 3); INSERT INTO produtos (produto, valor, categoria) VALUES ("Zotac NVIDIA GeForce GTX1060 6GB", 1059, 3); INSERT INTO produtos (produto, valor, categoria) VALUES ("ASUS NVIDIA GeForce GTX1050", 599, 3); INSERT INTO produtos (produto, valor, categoria) VALUES ("Monitor Gamer AOC LED 24 G2460PF", 1499, 4); INSERT INTO produtos (produto, valor, categoria) VALUES ("Monitor Samsung LED 24 LS24D332HSXZD", 799, 4); INSERT INTO produtos (produto, valor, categoria) VALUES ("Monitor Gamer ZOWIE LED 24 XL2430", 1999, 4); -- ESTOQUE: INSERT INTO estoque (produto, quantidade) VALUES (1, 300); INSERT INTO estoque (produto, quantidade) VALUES (2, 250); INSERT INTO estoque (produto, quantidade) VALUES (3, 400); INSERT INTO estoque (produto, quantidade) VALUES (4, 120); INSERT INTO estoque (produto, quantidade) VALUES (5, 210); INSERT INTO estoque (produto, quantidade) VALUES (6, 200); INSERT INTO estoque (produto, quantidade) VALUES (7, 140); INSERT INTO estoque (produto, quantidade) VALUES (8, 330); INSERT INTO estoque (produto, quantidade) VALUES (9, 370); INSERT INTO estoque (produto, quantidade) VALUES (10, 70); INSERT INTO estoque (produto, quantidade) VALUES (11, 110); INSERT INTO estoque (produto, quantidade) VALUES (12, 90); -- CLIENTES: INSERT INTO clientes (cliente, cpf, endereco, telefone) VALUES ("Carlos Roberto Almeida", "77180869090", "Avenida Palmares 399", "96991113510"); INSERT INTO clientes (cliente, cpf, endereco, telefone) VALUES ("Lucas Matias Silva", "49059859006", "Rua 31 de Julho 192", "96984045578"); INSERT INTO clientes (cliente, cpf, endereco, telefone) VALUES ("Nilsa Souza Oliveira", "35650382093", "Avenida dos Goitacazes 9001", "96981113510"); INSERT INTO clientes (cliente, cpf, endereco, telefone) VALUES ("Raissa de Lima Pereira", "66121200022", "União dos Buritis 92", "96989104570"); INSERT INTO clientes (cliente, cpf, endereco, telefone) VALUES ("Rebecca Moura Soares", "73469938024", "Macapaba 2, Bloco 4, Apt 141", "96984046661"); -- FORNECEDORES INSERT INTO fornecedores (fornecedor, email, telefone, descricao) VALUES ("KABUM", "kabum123@gmail.com", "1132224999", "Fornecedor de Perifericos"); INSERT INTO fornecedores (fornecedor, email, telefone, descricao) VALUES ("Pichau", "pichausp@gmail.com", "2132245050", "Fornecedor de Processadores"); INSERT INTO fornecedores (fornecedor, email, telefone, descricao) VALUES ("Balao da Informatica", "balaozin1111@gmail.com", "1131112000", "Fornecedor de Placas de Video"); INSERT INTO fornecedores (fornecedor, email, telefone, descricao) VALUES ("Cissa Magazine", "cissamagazine@gmail.com", "1136623662", "Fornecedor de Monitores"); -- FUNCIONARIOS INSERT INTO funcionarios (usuario, senha, funcionario, endereco, telefone, cpf, email, inicio, e_gerente, em_cargo, funcao) VALUES ("jojo", "jojo", "Joao Pedro Caldas", "Avenida dos Goitacazes", "96991105050", "79533122048", "joaopedro@hotmail.com", "2018-10-01", false, true, "Caixa"); INSERT INTO funcionarios (usuario, senha, funcionario, endereco, telefone, cpf, email, inicio, e_gerente, em_cargo, funcao, saida) VALUES ("sasa", "sasa", "Samanta Vera Lucia", "Avenida dos Aimores", "96991105555", "10260697001", "sasssa@hotmail.com", "2018-10-02", false, false, "Caixa", "2019-07-02"); INSERT INTO funcionarios (usuario, senha, funcionario, endereco, telefone, cpf, email, inicio, e_gerente, em_cargo, funcao) VALUES ("jolu", "jolu", "Jonathan Luiz Oliveira", "Avenida dos Tamoios", "96991105566", "13887229096", "jolujolu@hotmail.com", "2018-10-03", false, true, "Caixa"); -- SERVIÇOS: INSERT INTO servicos (servico, funcionario, valor) VALUES ("Limpeza de Computadores Domesticos", 3, 50); INSERT INTO servicos (servico, funcionario, valor) VALUES ("Montagem de Computadores Gamers", 4, 70); INSERT INTO servicos (servico, funcionario, valor) VALUES ("Cabeamento de rede em residencias", 5, 70); -- CAIXA: INSERT INTO caixa (item, quantidade, valor) VALUES ("Montagem de Computadores Gamers", 1, 70); INSERT INTO caixa (item, quantidade, valor) VALUES ("Mouse Gamer Logitech G403", 1, 199); INSERT INTO caixa (item, quantidade, valor) VALUES ("ASUS NVIDIA GeForce GTX1050", 1, 599);
/* Warnings: - You are about to drop the `CourseWhatLearn` table. If the table is not empty, all the data it contains will be lost. */ -- DropForeignKey ALTER TABLE "CourseWhatLearn" DROP CONSTRAINT "CourseWhatLearn_courseId_fkey"; -- CreateTable CREATE TABLE "CourseDetail" ( "id" SERIAL NOT NULL, "text" TEXT NOT NULL, "courseId" INTEGER NOT NULL, PRIMARY KEY ("id") ); -- DropTable DROP TABLE "CourseWhatLearn"; -- AddForeignKey ALTER TABLE "CourseDetail" ADD FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- phpMyAdmin SQL Dump -- version 4.8.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Tempo de geração: 31/05/2018 às 06:46 -- Versão do servidor: 10.1.31-MariaDB -- Versão do PHP: 7.2.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 */; -- -- Banco de dados: `oportunidadesbeta` -- -- -------------------------------------------------------- -- -- Estrutura para tabela `aluno` -- CREATE TABLE `aluno` ( `alunoID` int(11) NOT NULL, `aluno_cpf` varchar(255) NOT NULL, `nome` varchar(255) NOT NULL, `dataDeNascimento` date NOT NULL, `email` varchar(255) NOT NULL, `trabalhando` varchar(3) NOT NULL, `expec_sobre_curso` varchar(255) NOT NULL, `como_conheceu` varchar(255) NOT NULL, `FK_idCurso` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `aluno` -- INSERT INTO `aluno` (`alunoID`, `aluno_cpf`, `nome`, `dataDeNascimento`, `email`, `trabalhando`, `expec_sobre_curso`, `como_conheceu`, `FK_idCurso`) VALUES (1, '153.915.847-01', 'KAMILA PEREIRA DE FARIA', '1995-03-10', 'kamila.pereira1995@gmail.com', 'Não', 'Conseguir um emprego', 'Divulgação na TV', 32), (5, '176.688.997-23', 'GISLAINE QUIRINO', '1999-01-20', 'gislaynetexeira1999@gmail.com', 'Não', 'Aprimorar conhecimento', 'Internet', 33), (6, '139.767.227-74', 'GLEIVIA CRUZ DE OLIVEIRA', '1992-01-09', 'gleiviapaodavida2@gmail.com', 'Sim', 'Aprimorar conhecimento', 'Por meio de amigos', 33), (7, '974.896.675-50', 'SEBASTIANA JESUS DOS ANJOS', '1978-06-26', 'sebastiana@gmail.com', 'Não', 'Conseguir emprego', 'CRAS', 33), (8, '117.507.987-19', 'CARLA RODRIGUES', '1985-08-12', 'rodriguescarla650@gmail.com', 'Não', 'Conseguir emprego', 'Notíciários em jornais', 33), (9, '155.621.837-06', 'JULLIETE CAROLINE DOS SANTOS MELO', '1996-10-31', 'jullietemelo.96@gmail.com', 'Não', 'Conseguir emprego', 'Internet', 33), (10, '147.724.947-82', 'THAIS MARA DE OLIVEIRA SANTOS', '1993-05-01', 'thaysmara.oliveira93@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (11, '170.440.607-22', 'ROBERTA DE OLIVEIRA BATISTA', '1999-04-02', 'Robertabaolba@gmail.com', 'Não', 'Aprimorar conhecimento', 'Notíciários em jornais', 33), (12, '124.351.496-54', 'MARCONDES ANDRE DE OLIVEIRA', '1994-07-02', 'marconephp@outlook.com', 'Não', 'Aprimorar conhecimento', 'Por meio de amigos', 33), (13, '150.261.807-95', 'NAYARA SILVA GOMES', '2000-03-27', 'nayara_goomes27@hotmail.com', 'Não', 'Conseguir emprego', 'Internet', 33), (14, '772.654.573-90', 'SCHEILA DA CRUZ', '1978-06-10', 'rillary.cominotti@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (15, '347.701.477-40', 'IRACY RODRIGUES DA SILVA CALDEIRA', '1972-11-15', 'cqpviana@gmail.com', 'Não', 'Aprimorar conhecimento', 'Internet', 33), (16, '200.839.957-57', 'EVELIN HERCILIA CARVALHO PINTO', '1999-12-07', 'coord.crasmarcilio@viana.es.gov.br', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (17, '144.924.187-00', 'RAIANA LIMA', '1994-09-21', 'raiana.empresa@gmail.com.br', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (18, '908.090.676-00', 'JACQUELINE APARECIDA VIEIRA DE SOUZA', '1980-10-12', 'jacsouza121080@gmail.com', 'Não', 'Conseguir emprego', 'Internet', 33), (19, '113.070.707-52', 'KEILA SILVA DOS SANTOS', '1986-04-10', 'keilassilva86@hotmail.com', 'Não', 'Conseguir emprego', 'Internet', 33), (20, '186.170.157-80', 'VITOR SILVÉRIO BRAGA', '1999-11-12', 'vitbraga588@gmail.com', 'Não', 'Aprimorar conhecimento', 'Internet', 33), (21, '974.426.776-30', 'KELLY BARCELOS DOS SANTOS', '1982-04-12', 'keilassilva86@hotmail.com', 'Não', 'Gerar renda com negócio próprio', 'Internet', 33), (22, '148.907.137-78', 'KEVEM DE OLIVEIRA SANTOS', '2000-04-20', 'kevemoliveira2000@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (23, '659.310.244-00', 'ADRINA FREITAS DE ALBUQUERQUE', '1986-07-22', 'adrianamurilomilena@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (24, '151.349.797-90', 'DANDARA CRISTINA BATISTA DA SILVA', '1991-10-24', 'dandaracristinacris@gmail.com', 'Não', 'Conseguir emprego', 'Internet', 33), (25, '978.874.773-60', 'ANDRÉIA COZER RIBEIRO MENDES', '1978-05-22', 'andreiacozer15@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (26, '122.137.587-35', 'SAMIRA DOS SANTOS BATISTA', '1992-12-16', 'samirastofel8@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (27, '107.795.517-02', 'ALAN FERREIRA DOS SANTOS', '1994-11-23', 'alhan.brasil@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33), (30, '100.063.687-94', 'DIOGO GAVA', '1984-11-14', 'diogogava14@hotmail.com', 'Sim', 'Conseguir um emprego', 'Por meio de amigos', 34), (32, '123.541.927-46', 'JULIANA CRISTINA DE OLIVEIRA ', '1990-11-21', 'jujukinha.correia2@gmail.com', 'Sim', 'Conseguir um emprego', 'Divulgação na TV', 32), (33, '129.640.367-05', 'JULIANA DE MELO MAIA', '1988-02-11', 'julianamelo@1324gmail.com', 'Não', 'Conseguir um emprego', 'Divulgação na TV', 32), (34, '153.746.867-71', 'RENAN DA SILVA SANTOS ', '1996-10-18', 'renan-s2011@hotmail.com', 'Sim', 'Conseguir um emprego', 'Noticiários em Jornais', 32), (35, '120.092.077-50', 'RENAN VERONESI FERREIRA', '1989-04-05', 'cadastros.org@live.com', 'Sim', 'Conseguir um emprego', 'Noticiários em Jornais', 32), (36, '666.817.737-96', 'RENAN MOREIRA GOMES', '1995-03-10', 'willianoliveira608@gmail.com', 'Sim', 'Conseguir um emprego', 'Divulgação na TV', 12), (37, '118.609.590-32', 'BILL FERREIRA', '1995-03-10', 'willianoliveira608@gmail.com', 'Não', 'Agregar conhecimento', 'Divulgação na TV', 1), (55, '666.817.737-96', 'PEDRO DA SILVA', '1998-04-14', 'willia@bill.corp.com', 'Sim', 'Agregar conhecimento', 'Divulgação na TV', 7); -- -------------------------------------------------------- -- -- Estrutura para tabela `curso` -- CREATE TABLE `curso` ( `idCurso` int(11) NOT NULL, `nome` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `curso` -- INSERT INTO `curso` (`idCurso`, `nome`) VALUES (1, 'Administração de pequenos negócios'), (2, 'Auxiliar de Departamento pessoal'), (3, 'Balconista de Farmácia'), (4, 'Berçarista'), (5, 'Como Organizar seu Evento'), (6, 'Cuidador Infantil'), (7, 'Excel Avançado'), (8, 'Gestão de Rotinas Administrativas'), (9, 'Gestão Financeiras de Empresa pequena e Médias Empresas'), (10, 'Introdução à Nova Legislação Trabalhista'), (11, 'Logística'), (12, 'Operador de Caixa'), (13, 'Rede de Computadores'), (14, 'Secretaria Escolar'), (15, 'Segurança na Internet'), (32, 'Informática para concursos'), (33, 'Informática para Educadores'), (34, 'Informática Avançada'), (35, 'Inglês Básico'); -- -------------------------------------------------------- -- -- Estrutura para tabela `curso_aluno` -- CREATE TABLE `curso_aluno` ( `Aluno_Nome` varchar(255) NOT NULL, `Aluno_CPF` varchar(255) NOT NULL, `fk_cursoID` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `curso_aluno` -- INSERT INTO `curso_aluno` (`Aluno_Nome`, `Aluno_CPF`, `fk_cursoID`) VALUES ('KAMILA PEREIRA DE FARIA', '153.915.847-01', 32), ('KAMILA RAMOS LIBERATO ', '173.382.067-16', 32), ('DIEGO ANDRADE DE SOUSA', '232.731.318-02', 33), ('DIOGO GAVA', '100.063.687-94', 34), ('WILLIAN FERREIRA L. DE OLIVEIRA', '100.842.817-58', 10), ('JULIANA CRISTINA DE OLIVEIRA ', '123.541.927-46', 32), ('JULIANA DE MELO MAIA', '129.640.367-05', 32), ('RENAN DA SILVA SANTOS ', '153.746.867-71', 32), ('RENAN VERONESI FERREIRA', '120.092.077-50', 32), ('Daniel da Silva Reis', '184.356.467-00', 33), ('Keila Silva dos Santos', '113.070.707-52', 33), ('Eliete Fernandes Martins', '363.776.053-60', 33), ('André Cardoso', '148.907.307-88', 33), ('Gislaine quirino', '176.688.997-23', 33), ('Gleivia cruz De Oliveira', '139.767.227-74', 33), ('SEBASTIANA JESUS DOS ANJOS', '974.896.675-50', 33), ('carla rodrigues', '117.507.987-19', 33), ('Julliete caroline dos santos melo', '155.621.837-06', 33), ('Thais Mara de Oliveira Santos', '147.724.947-82', 33), ('Roberta de Oliveira Batista', '170.440.607-22', 33), ('Marcondes Andre De Oliveira', '124.351.496-54', 33), ('Nayara Silva Gomes', '150.261.807-95', 33), ('SCHEILA Da CRUZ', '772.654.573-90', 33), ('Iracy Rodrigues da Silva Caldeira', '347.701.477-40', 33), ('Evelin Hercilia Carvalho Pinto', '200.839.957-57', 33), ('Raiana Lima', '144.924.187-00', 33), ('Jacqueline Aparecida Vieira de Souz', '908.090.676-00', 33), ('Keila Silva dos Santos', '113.070.707-52', 33), ('Vitor Silvério Braga', '186.170.157-80', 33), ('Kelly Barcelos dos santos', '974.426.776-30', 33), ('Kevem de Oliveira Santos', '148.907.137-78', 33), ('Adrina freitas de albuquerque', '659.310.244-00', 33), ('dandara cristina batista da silva', '151.349.797-90', 33), ('Andréia cozer Ribeiro Mendes', '978.874.773-60', 33), ('Samira dos Santos Batista', '122.137.587-35', 33), ('Alan Ferreira dos Santos', '107.795.517-02', 33), ('RENAN MOREIRA GOMES', '666.817.737-96', 12), ('BILL FERREIRA', '118.609.590-32', 1), ('PEDRO DA SILVA', '666.817.737-96', 7), ('PEDRO DA SILVA', '666.817.737-96', 7), ('PEDRO DA SILVA', '666.817.737-96', 7), ('PEDRO DA SILVA', '666.817.737-96', 7), ('KAMILA PEREIRA DE FARIA', '153.915.847-01', 34), ('DIOGO GAVA', '100.063.687-94', 34), ('KAMILA PEREIRA DE FARIA', '153.915.847-01', 32); -- -------------------------------------------------------- -- -- Estrutura para tabela `curso_instituicao` -- CREATE TABLE `curso_instituicao` ( `fk_idCurso` int(11) NOT NULL, `fk_instituicao_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `curso_instituicao` -- INSERT INTO `curso_instituicao` (`fk_idCurso`, `fk_instituicao_id`) VALUES (32, 11), (33, 11), (34, 11), (32, 12), (33, 12), (34, 12), (35, 13), (32, 13), (33, 13), (34, 13), (35, 14), (34, 14), (33, 14), (32, 14), (35, 11); -- -------------------------------------------------------- -- -- Estrutura para tabela `duplicados` -- CREATE TABLE `duplicados` ( `alunoDuplicadoID` int(11) NOT NULL, `IDtabelaPrincipal` int(11) NOT NULL, `aluno_cpf` varchar(255) NOT NULL, `nome` varchar(255) NOT NULL, `dataDeNascimento` date NOT NULL, `email` varchar(255) NOT NULL, `trabalhando` varchar(255) NOT NULL, `expec_sobre_curso` varchar(255) NOT NULL, `como_conheceu` varchar(255) NOT NULL, `FK_idCurso` int(11) NOT NULL, `cep` varchar(255) DEFAULT NULL, `rua` varchar(255) NOT NULL, `bairro` varchar(255) NOT NULL, `cidade` varchar(255) NOT NULL, `numeroResidencia` varchar(255) NOT NULL, `telefone1` varchar(255) NOT NULL, `telefone2` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `duplicados` -- INSERT INTO `duplicados` (`alunoDuplicadoID`, `IDtabelaPrincipal`, `aluno_cpf`, `nome`, `dataDeNascimento`, `email`, `trabalhando`, `expec_sobre_curso`, `como_conheceu`, `FK_idCurso`, `cep`, `rua`, `bairro`, `cidade`, `numeroResidencia`, `telefone1`, `telefone2`) VALUES (2, 2, '153.915.847-01', 'KAMILA PEREIRA DE FARIA', '1995-03-10', 'kamila.pereira1995@gmail.com', 'Sim', 'Agregar conhecimento', 'Noticiários em Jornais', 33, '29.141-219', 'Rua Vasco da Gama', 'Boa Sorte', 'Cariacica', '16', '(28)58631-2546', '(32)15896-4539'), (4, 0, '153.915.847-01', 'KAMILA PEREIRA DE FARIA', '1995-03-10', 'kamila.pereira1995@gmail.com', 'Sim', 'Agregar conhecimento', 'Noticiários em Jornais', 35, '29.141-219', 'Rua Vasco da Gama', 'Boa Sorte', 'Cariacica', '16', '(28)58631-2546', '(32)15896-4539'), (5, 3, '153.915.847-01', 'KAMILA PEREIRA DE FARIA', '1995-03-10', 'kamila.pereira1995@gmail.com', 'Sim', 'Agregar conhecimento', 'Noticiários em Jornais', 32, '29.141-219', 'Rua Vasco da Gama', 'Boa Sorte', 'Cariacica', '16', '(28)58631-2546', '(32)15896-4539'), (6, 38, '100.842.817-58', 'WILLIAN FERREIRA L. DE OLIVEIRA', '1998-04-14', 'bill@corp.com', 'Não', 'alguma ', 'fofoca', 10, '29.127-045', 'Rua Minas Gerais', 'Boa Sorte', 'Cariacica', '58', '(26)59045-7849', '(26)59045-7849'), (7, 39, '153.915.847-01', 'KAMILA PEREIRA DE FARIA', '1995-03-10', 'kamila.pereira1995@gmail.com', 'Sim', 'Conseguir um emprego', 'Divulgação na TV', 32, '29.141-219', 'Rua Vasco da Gama', 'Boa Sorte', 'Cariacica', '14', '(27)99926-3153', '(27)99926-3153'), (8, 40, '232.731.318-02', 'DIEGO ANDRADE DE SOUSA', '1990-03-03', 'diego.andrade1embali@gmail.com', 'Sim', 'Conseguir um emprego', 'Por meio de amigos', 33, '29.148-635', 'Rua das Hortências', 'Vila Independência', 'Cariacica', '9', '(27)99693-2436', '(27)99693-2436'), (9, 41, '173.382.067-16', 'KAMILA RAMOS LIBERATO ', '1996-12-04', 'ramoskamila71@gmail.com', 'Sim', 'ficar rica', 'Por meio de amigos', 32, '29.146-650', 'Rua Hugo Viola', 'São Geraldo', 'Cariacica', '16', '(27)998179-812', '(27)998179-812'), (10, 42, '184.356.467-00', 'DANIEL DA SILVA REIS', '1998-10-22', 'danieldasilvareis990@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33, '29.127-045', 'Caxias do Sul', 'Soteco', 'Viana', '1052', '(27)99649-1442', '(27)99649-1442'), (11, 43, '113.070.707-52', 'KEILA SILVA DOS SANTOS', '1986-04-10', 'keilassilva86@hotmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33, '29.127-045', 'Rua: Alfredo Cavalieri', 'Soteco', 'Viana', '1053', '(27)99860-4899', '(27)99860-4899'), (12, 44, '363.776.053-60', 'ELIETE FERNANDES MARTINS', '1970-10-20', 'elizettyfmartins@gnail.com', 'Não', 'Conseguir emprego', 'Internet', 33, '29.127-045', 'Rua sata catarina', 'Areinha', 'Viana', '1054', '(27)99925-1948', '(27)99925-1948'), (13, 45, '148.907.307-88', 'ANDRÉ CARDOSO', '1996-04-16', 'andcardpaga@gmail.com', 'Não', 'Conseguir emprego', 'Por meio de amigos', 33, '29.127-045', 'Rua 2', 'Soteco', 'Viana', '1055', '(27)99607-5469', '(27)99607-5469'), (16, 46, '118.609.590-32', 'BILL FERREIRA', '1995-03-10', 'willianoliveira608@gmail.com', 'Não', 'Agregar conhecimento', 'Divulgação na TV', 1, '29.148-635', 'Rua das Hortências', 'Vila Independência', 'Cariacica', '589', '(28)58631-2546', '(32)15896-4539'), (17, 47, '118.609.590-32', 'BILL FERREIRA', '1995-03-10', 'willianoliveira608@gmail.com', 'Não', 'Agregar conhecimento', 'Divulgação na TV', 1, '29.148-635', 'Rua das Hortências', 'Vila Independência', 'Cariacica', '589', '(28)58631-2546', '(32)15896-4539'), (18, 48, '118.609.590-32', 'BILL FERREIRA', '1995-03-10', 'willianoliveira608@gmail.com', 'Não', 'Conseguir um emprego', 'Noticiários em Jornais', 2, '29.148-635', 'Rua das Hortências', 'Vila Independência', 'Cariacica', '41', '(28)58631-2546', '(23)65897-4563'), (22, 54, '118.609.590-32', 'BILL FERREIRA', '1995-03-10', 'willianoliveira608@gmail.com', 'Sim', 'Gerara renda com um empreendimento próprio', 'Noticiários em Jornais', 3, '29.148-635', 'Rua das Hortências', 'Vila Independência', 'Cariacica', '658', '(25)58965-4855', '(23)65897-4563'), (26, 56, '666.817.737-96', 'PEDRO DA SILVA', '1998-04-14', 'willia@bill.corp.com', 'Sim', 'Agregar conhecimento', 'Divulgação na TV', 7, '29.140-035', 'Rua Muniz Freire', 'Jardim América', 'Cariacica', '576', '(25)58965-4855', '(27)99926-3153'), (28, 4, '153.915.847-01', 'KAMILA PEREIRA DE FARIA', '1995-03-10', 'kamila.pereira1995@gmail.com', 'Sim', 'Agregar conhecimento', 'Noticiários em Jornais', 34, '29.141-219', 'Rua Vasco da Gama', 'Boa Sorte', 'Cariacica', '16', '(28)58631-2546', '(32)15896-4539'); -- -------------------------------------------------------- -- -- Estrutura para tabela `endereco` -- CREATE TABLE `endereco` ( `cep` varchar(255) NOT NULL, `rua` varchar(255) NOT NULL, `bairro` varchar(255) NOT NULL, `cidade` varchar(255) NOT NULL, `numeroResidencia` varchar(255) DEFAULT NULL, `fk_alunoID` int(11) DEFAULT NULL, `fk_instituicao_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `endereco` -- INSERT INTO `endereco` (`cep`, `rua`, `bairro`, `cidade`, `numeroResidencia`, `fk_alunoID`, `fk_instituicao_id`) VALUES ('29.127-045', 'Avenida Muriaé', 'João Goulart', 'Vila Velha', 's/n', NULL, 11), ('29.127-045', 'Avenida Muriaé', 'João Goulart', 'Vila Velha', 's/n', NULL, 12), ('29.127-045', 'Avenida Muriaé', 'João Goulart', 'Vila Velha', 's/n', NULL, 13), ('29.127-045', 'Avenida Muriaé', 'João Goulart', 'Vila Velha', 's/n', NULL, 14), ('29.127-045', 'Avenida Muriaé', 'João Goulart', 'Vila Velha', '450', 32, NULL), ('29.140-035', 'Rua Muniz Freire', 'Jardim América', 'Cariacica', '256', 33, NULL), ('29.140-160', 'Rua Chile', 'Jardim América', 'Cariacica', '539', 34, NULL), ('29.140-330', 'Rua Labrador', 'Jardim América', 'Cariacica', '5236', 35, NULL), ('29.127-045', 'Rua São Luiz', 'Soteco', 'Viana', '1056', 5, NULL), ('29.127-045', 'Rua sao pau', 'Caxias do Sul', 'Viana', '1053', 6, NULL), ('29.127-045', 'RUA TONOLEIROS', 'Areinha', 'Viana', '1058', 7, NULL), ('29.127-045', 'José acassio ferreira', 'Soteco', 'Viana', '1058', 8, NULL), ('29.127-045', 'Rua:São Paulo', 'Soteco', 'Viana', '1058', 9, NULL), ('29.127-045', 'Rua Fortaleza', 'Soteco', 'Viana', '1058', 10, NULL), ('29.127-045', 'Rio novo do sul', 'Arlindo Villaschi', 'Viana', '1058', 11, NULL), ('29.127-045', 'Rua Juparanã', 'Nova Bethânia', 'Viana', '1058', 12, NULL), ('29.127-045', 'Rua Colatina', 'Marcílio de Noronha', 'Viana', '1058', 13, NULL), ('29.127-045', 'Rua xavier', 'Industrial', 'Viana', '1058', 14, NULL), ('29.127-045', 'Rua São Jorge', 'Arlindo Villaschi', 'Viana', '1058', 15, NULL), ('29.127-045', 'Rua Rio Grande do sul', 'Marcílio de Noronha', 'Viana', '1058', 16, NULL), ('29.127-045', 'Rua Ataide ervate', 'Industrial', 'Viana', '1058', 17, NULL), ('29.127-045', 'Rua Alfredo Cavalieri', 'Soteco', 'Viana', '1058', 18, NULL), ('29.127-045', 'Rua Alfredo Cavalieri', 'Soteco', 'Viana', '1058', 19, NULL), ('29.127-045', 'Rua Maria Soares de Jesus', 'Soteco', 'Viana', '1058', 20, NULL), ('29.127-045', 'Av.josé Acácio ferreira', 'Soteco', 'Viana', '1058', 21, NULL), ('29.127-045', 'Bar do Renato', 'Soteco', 'Viana', '1058', 22, NULL), ('29.127-045', 'Rua maranhao', 'Caxias do Sul', 'Viana', '1058', 23, NULL), ('29.127-045', 'Rua Alfredo Cavalieri', 'Soteco', 'Viana', '1058', 24, NULL), ('29.127-045', 'Rua, Laurentino Teodoro de Souza', 'Soteco', 'Viana', '1058', 25, NULL), ('29.127-045', 'rua: Carmerinos', 'Areinha', 'Viana', '1058', 26, NULL), ('29.127-045', 'Rua Toneleiro Augusto 32', 'Areinha', 'Viana', '1058', 27, NULL), ('29.127-045', 'Avenida Muriaé', 'João Goulart', 'Vila Velha', '58', 36, NULL), ('29.148-635', 'Rua das Hortências', 'Vila Independência', 'Cariacica', '589', 37, NULL), ('29.140-035', 'Rua Muniz Freire', 'Jardim América', 'Cariacica', '576', 55, NULL), ('29.142-241', 'Rua Nova Bela Aurora', 'Formate', 'Cariacica', '560', 30, NULL), ('29.141-219', 'Rua Vasco da Gama', 'Boa Sorte', 'Cariacica', '8', 1, NULL); -- -------------------------------------------------------- -- -- Estrutura para tabela `instituicao` -- CREATE TABLE `instituicao` ( `instituicao_id` int(11) NOT NULL, `nome` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `instituicao` -- INSERT INTO `instituicao` (`instituicao_id`, `nome`) VALUES (11, 'Unidade Viana'), (12, 'Unidade Vila Velha'), (13, 'Unidade Cariacica'), (14, 'Unidade Serra'); -- -------------------------------------------------------- -- -- Estrutura para tabela `periodo_curso` -- CREATE TABLE `periodo_curso` ( `fk_cursoID` int(11) NOT NULL, `fk_instituicaoID` int(11) NOT NULL, `dataInicio` date NOT NULL, `dataFim` date NOT NULL, `turno` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `periodo_curso` -- INSERT INTO `periodo_curso` (`fk_cursoID`, `fk_instituicaoID`, `dataInicio`, `dataFim`, `turno`) VALUES (32, 11, '2018-05-20', '2019-05-20', 'vespertino'), (33, 11, '2018-05-20', '2019-05-20', 'noturno'), (34, 11, '2018-05-20', '2019-05-20', 'matutino'), (32, 12, '2018-05-20', '2019-05-20', 'vespertino'), (33, 12, '2018-05-20', '2019-05-20', 'matutino'), (34, 12, '2018-05-20', '2019-05-20', 'noturno'), (35, 13, '2018-05-20', '2019-05-20', 'matutino'), (32, 13, '2018-05-20', '2019-05-20', 'vespertino'), (33, 13, '2018-05-20', '2019-05-20', 'noturno'), (34, 13, '2018-05-20', '2019-05-20', 'matutino'), (35, 14, '2018-05-20', '2019-05-20', 'matutino'), (34, 14, '2018-05-20', '2019-05-20', 'vespertino'), (33, 14, '2018-05-20', '2019-05-20', 'matutino'), (32, 14, '2018-05-20', '2019-05-20', 'noturno'), (35, 11, '2018-05-20', '2019-05-20', 'Vespertino'); -- -------------------------------------------------------- -- -- Estrutura para tabela `telefone` -- CREATE TABLE `telefone` ( `telefone1` varchar(255) DEFAULT NULL, `telefone2` varchar(255) DEFAULT NULL, `fk_alunoID` int(11) DEFAULT NULL, `fk_instituicao_id` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Fazendo dump de dados para tabela `telefone` -- INSERT INTO `telefone` (`telefone1`, `telefone2`, `fk_alunoID`, `fk_instituicao_id`) VALUES ('(28)58631-2546', '(25)63698-5457', NULL, 11), ('(28)58631-2546', '(25)63698-5457', NULL, 12), ('(28)58631-2546', '(25)63698-5457', NULL, 13), ('(28)58631-2546', '(25)63698-5457', NULL, 14), ('(27)99622-1880', '(27)99864-0882', 32, NULL), ('(27)9971-6585', '(27)9880-7940', 33, NULL), ('(27)98881-6180', '(27)99924-0932', 34, NULL), ('(27)99796-3590', '(27)99796-3590', 35, NULL), ('(27)99851-6734', '(27)99851-6734', 5, NULL), ('(27)99721-4065', '(27)99721-4065', 6, NULL), ('(27)99637-9588', '(27)99637-9588', 7, NULL), ('(27)99700-5209', '(27)99700-5209', 8, NULL), ('(27)99919-3649', '(27)99919-3649', 9, NULL), ('(27)99899-9096', '(27)99899-9096', 10, NULL), ('(27)99830-7147', '(27)99830-7147', 11, NULL), ('(27)99503-3686', '(27)99503-3686', 12, NULL), ('(27)99643-3635', '(27)99643-3635', 13, NULL), ('(27)99751-2177', '(27)99751-2177', 14, NULL), ('(27)33446-3515', '(27)33446-3515', 15, NULL), ('(27)99987-5024', '(27)99987-5024', 16, NULL), ('(27)99783-1143', '(27)99783-1143', 17, NULL), ('(27)99903-9050', '(27)99903-9050', 18, NULL), ('(27)99860-4899', '(27)99860-4899', 19, NULL), ('(27)99950-4220', '(27)99950-4220', 20, NULL), ('(27)99711-1079', '(27)99711-1079', 21, NULL), ('(27)99839-8158', '(27)99839-8158', 22, NULL), ('(27)99919-7282', '(27)99919-7282', 23, NULL), ('(27)99635-5530', '(27)99635-5530', 24, NULL), ('(27)99887-2561', '(27)99887-2561', 25, NULL), ('(27)99744-3951', '(27)99744-3951', 26, NULL), ('(27)99716-7156', '(27)99716-7156', 27, NULL), ('(28)58631-2546', '(32)15896-4539', 36, NULL), ('(28)58631-2546', '(32)15896-4539', 37, NULL), ('(25)58965-4855', '(27)99926-3153', 55, NULL), ('(28)58631-2546', '(32)15896-4539', 30, NULL), ('(28)58631-2546', '(32)15896-4539', 1, NULL); -- -- Índices de tabelas apagadas -- -- -- Índices de tabela `aluno` -- ALTER TABLE `aluno` ADD PRIMARY KEY (`alunoID`), ADD KEY `fk_curso` (`FK_idCurso`); -- -- Índices de tabela `curso` -- ALTER TABLE `curso` ADD PRIMARY KEY (`idCurso`); -- -- Índices de tabela `curso_aluno` -- ALTER TABLE `curso_aluno` ADD KEY `fk_curso_idCurso` (`fk_cursoID`); -- -- Índices de tabela `curso_instituicao` -- ALTER TABLE `curso_instituicao` ADD KEY `fk_curso_2` (`fk_idCurso`), ADD KEY `fk_instituicao_2` (`fk_instituicao_id`); -- -- Índices de tabela `duplicados` -- ALTER TABLE `duplicados` ADD PRIMARY KEY (`alunoDuplicadoID`); -- -- Índices de tabela `endereco` -- ALTER TABLE `endereco` ADD KEY `fk_instituicao_id` (`fk_instituicao_id`), ADD KEY `fk_alunoID` (`fk_alunoID`); -- -- Índices de tabela `instituicao` -- ALTER TABLE `instituicao` ADD PRIMARY KEY (`instituicao_id`); -- -- Índices de tabela `periodo_curso` -- ALTER TABLE `periodo_curso` ADD KEY `fk_cursoID` (`fk_cursoID`), ADD KEY `fk_instituicaoID` (`fk_instituicaoID`); -- -- Índices de tabela `telefone` -- ALTER TABLE `telefone` ADD KEY `fk_telefone_instituicao_id` (`fk_instituicao_id`), ADD KEY `fk_telefone_alunoID` (`fk_alunoID`); -- -- AUTO_INCREMENT de tabelas apagadas -- -- -- AUTO_INCREMENT de tabela `aluno` -- ALTER TABLE `aluno` MODIFY `alunoID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=57; -- -- AUTO_INCREMENT de tabela `curso` -- ALTER TABLE `curso` MODIFY `idCurso` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT de tabela `duplicados` -- ALTER TABLE `duplicados` MODIFY `alunoDuplicadoID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; -- -- AUTO_INCREMENT de tabela `instituicao` -- ALTER TABLE `instituicao` MODIFY `instituicao_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- Restrições para dumps de tabelas -- -- -- Restrições para tabelas `aluno` -- ALTER TABLE `aluno` ADD CONSTRAINT `fk_curso` FOREIGN KEY (`FK_idCurso`) REFERENCES `curso` (`idCurso`); -- -- Restrições para tabelas `curso_aluno` -- ALTER TABLE `curso_aluno` ADD CONSTRAINT `fk_curso_idCurso` FOREIGN KEY (`fk_cursoID`) REFERENCES `curso` (`idCurso`); -- -- Restrições para tabelas `curso_instituicao` -- ALTER TABLE `curso_instituicao` ADD CONSTRAINT `fk_curso_2` FOREIGN KEY (`fk_idCurso`) REFERENCES `curso` (`idCurso`), ADD CONSTRAINT `fk_instituicao_2` FOREIGN KEY (`fk_instituicao_id`) REFERENCES `instituicao` (`instituicao_id`); -- -- Restrições para tabelas `endereco` -- ALTER TABLE `endereco` ADD CONSTRAINT `fk_alunoID` FOREIGN KEY (`fk_alunoID`) REFERENCES `aluno` (`alunoID`), ADD CONSTRAINT `fk_instituicao_id` FOREIGN KEY (`fk_instituicao_id`) REFERENCES `instituicao` (`instituicao_id`); -- -- Restrições para tabelas `periodo_curso` -- ALTER TABLE `periodo_curso` ADD CONSTRAINT `fk_cursoID` FOREIGN KEY (`fk_cursoID`) REFERENCES `curso` (`idCurso`), ADD CONSTRAINT `fk_instituicaoID` FOREIGN KEY (`fk_instituicaoID`) REFERENCES `instituicao` (`instituicao_id`); -- -- Restrições para tabelas `telefone` -- ALTER TABLE `telefone` ADD CONSTRAINT `fk_telefone_alunoID` FOREIGN KEY (`fk_alunoID`) REFERENCES `aluno` (`alunoID`), ADD CONSTRAINT `fk_telefone_instituicao_id` FOREIGN KEY (`fk_instituicao_id`) REFERENCES `instituicao` (`instituicao_id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE DATABASE DB_Account; USE DB_Account; DROP TABLE IF EXISTS Bill; CREATE TABLE Bill ( Id int(10) unsigned NOT NULL AUTO_INCREMENT, PayAmount int(10) unsigned NOT NULL, CategoryId int(10) unsigned DEFAULT '0', Remark text, CreateTime date NOT NULL, AccountName varchar(32) NOT NULL, PRIMARY KEY (Id), KEY idx_sum (AccountName,CreateTime,CategoryId) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS BillCategory; CREATE TABLE BillCategory ( Id int(10) unsigned NOT NULL AUTO_INCREMENT, Name varchar(20) NOT NULL, AccountName varchar(32) NOT NULL, PRIMARY KEY (Id), KEY idx_account (AccountName) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS Account; CREATE TABLE Account ( Name varchar(32) NOT NULL, Password varchar(32) NOT NULL, PRIMARY KEY (Name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
■問題文 ユーザーテーブル(usr)のf_name_kana列の後方に以下の列を追加してみましょう。 ・sex列(VARCHAR(5)型、デフォルト値は男) ・job列(VARCHAR(30)型) ■実行文 # ユーザーテーブルの定義を変更する ALTER TABLE usr # sex列(VARCHAR(5)型、デフォルト値は男)を追加する ADD sex VARCHAR(5) DEFAULT '男' # sex列の追加先はf_name_kana列の後方とする AFTER f_name_kana, # job列(VARCHAR(30)型)を追加する ADD job VARCHAR(30) # job列の追加先はsex列の後方とする AFTER sex ; ■返却値 mysql> # ユーザーテーブルの定義を変更する mysql> ALTER TABLE -> usr -> # sex列(VARCHAR(5)型、デフォルト値は男)を追加する -> ADD -> sex VARCHAR(5) DEFAULT '男' -> # sex列の追加先はf_name_kana列の後方とする -> AFTER -> f_name_kana, -> # job列(VARCHAR(30)型)を追加する -> ADD -> job VARCHAR(30) -> # job列の追加先はsex列の後方とする -> AFTER -> sex -> ; Query OK, 0 rows affected (0.27 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> desc usr; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+ | user_id | char(7) | NO | PRI | | | | l_name | varchar(20) | YES | | NULL | | | f_name | varchar(20) | YES | | NULL | | | l_name_kana | varchar(100) | YES | | NULL | | | f_name_kana | varchar(100) | YES | | NULL | | | sex | varchar(5) | YES | | 男 | | | job | varchar(30) | YES | | NULL | | | prefecture | varchar(15) | YES | MUL | NULL | | | city | varchar(20) | YES | | NULL | | | o_address | varchar(100) | YES | | NULL | | | tel | varchar(20) | YES | | NULL | | | email | varchar(255) | YES | | NULL | | +-------------+--------------+------+-----+---------+-------+ 12 rows in set (0.04 sec)
create database ALUNOS_CURSOS; use ALUNOS_CURSOS; create table ALUNOS_CURSOS( ID_ALUNO int auto_increment, ID_CURSO int, NOTA int, primary key (ID_ALUNO), foreign key (ID_CURSO) references DESCRICAO (ID_CURSO)); drop table ALUNOS_CURSOS; create table DESCRICAO( ID_CURSO int auto_increment, DESCRICAO varchar(5500), primary key (ID_CURSO)); Insert into DESCRICAO (DESCRICAO) values ("Rotinas Administrativas: Secretariado, Administracao Financeira, Matemática Financeira, Propaganda & Marketing, Telemarketing"); Select * from DESCRICAO; Insert into ALUNOS_CURSOS (ID_CURSO,NOTA) values (1,10),(1,25); SELECT * FROM alunos_cursos INNER JOIN DESCRICAO ON alunos_cursos.ID_CURSO=DESCRICAO.ID_CURSO;
SELECT * FROM efforts WHERE id IN (${id:csv})
-- redo-per-second.sql -- Jared Still 2022 -- as per sysmetric_history -- aggregates are per AWR snapshot interval, and min/avg/max chosen col min_redo_per_second format 999,999,999 col avg_redo_per_second format 999,999,999 col max_redo_per_second format 999,999,999 with metrics as ( select end_interval_time ,metric_name , value from dba_hist_sysmetric_history m join dba_hist_snapshot s on s.snap_id = m.snap_id where metric_name = 'Redo Generated Per Sec' order by m.snap_id ) select --end_interval_time, min(redo_per_sec) min_redo_per_second , avg(redo_per_sec) avg_redo_per_second , max(redo_per_sec) max_redo_per_second from ( select end_interval_time , metric_name , value from metrics ) pivot ( max(value) for metric_name in ( 'Redo Generated Per Sec' as redo_per_sec ) ) /
-- jsdjfksd fkdsjf ksdf sdf dfsd fsd DELETE FROM `second_table` WHERE `score` <= 5
/* Name: Total Development Views details Data source: 4 Created By: Admin Last Update At: 2016-11-21T20:07:45.774952+00:00 */ SELECT v.Development AS Development, D.name AS DevelopmentName, v.Views as Views, FROM (SELECT post_prop20 AS Development,count(*) as Views, FROM (TABLE_QUERY(djomniture:cipomniture_djmansionglobal,'CONCAT(REPLACE(table_id,"_","-"),"-01") BETWEEN STRFTIME_UTC_USEC("{{startdate}}", "%Y-%m-01") and STRFTIME_UTC_USEC("{{enddate}}", "%Y-%m-31")')) WHERE post_page_event = "0" /*Page View Calls*/ AND DATE(date_time) >= DATE('{{startdate}}') AND DATE(date_time) <= DATE('{{enddate}}') AND post_prop19 = 'development' /* Counting development */ group by Development order by Views desc) v JOIN (SELECT string(id) AS did, name, string(developer_id) AS developer_id , created_at FROM[djomniture:devspark.MG_Developments] ) AS D ON D.did=v.Development
CREATE TABLE USER ( USERID INT UNSIGNED NOT NULL, LOGINID VARCHAR(64) NOT NULL, NAME_JA VARCHAR(64) NOT NULL, NAME_EN VARCHAR(64) NOT NULL, PASSWORD VARCHAR(64) NOT NULL, FACEBOOK_UID VARCHAR(256), GITHUB_UID VARCHAR(256), GOOGLE_UID VARCHAR(256), PRIMARY KEY (USERID) ); INSERT INTO USER( USERID, LOGINID, NAME_JA, NAME_EN, PASSWORD) VALUES ( 0, 'admin', '管理者', 'administrator', 'admin'); INSERT INTO USER( USERID, LOGINID, NAME_JA, NAME_EN, PASSWORD) VALUES ( 1, 'itakura', '板倉', 'itakura', 'itakura');
CREATE TABLE pregunta( idPregunta int Not null AUTO_INCREMENT, idPublicacion int not null, texto_pregunta text(1000), texto_respuesta text(1000), idUsuario int not null, PRIMARY KEY (idPregunta, idPublicacion), FOREIGN KEY (idPublicacion) REFERENCES publicacion(idpublicacion), FOREIGN KEY (idUsuario) REFERENCES usuario(idusuario) )
ALTER TABLE items ADD COLUMN ruby VARCHAR(100);
/************* Materialized Views **************/ /* if we check on Database > specific Database? Schema > Materialized Views > there may not be anything if don't have exsisting one. */ -- Create new materialized view CREATE MATERIALIZED VIEW mv_staff AS( SELECT s.last_name, s.department, s.job_title, cr.company_regions FROM staff s JOIN company_regions cr ON cr.region_id = s.region_id ); -- get data from materialized view SELECT * FROM mv_staff LIMIT 10; ------------- Limitation of Materialized Views ----------- /* If there is any changes to source table (in this case staff and company_regions), our materialzed views data won't be refelected automatically. So data will become stale over time. Thus, we need to refresh data on materialized view. */ ------------ Refershing Materialized Views ----------------- /* this will rebuild the entire table and repopulate the data. so we need to consider carefully how often we want to refresh it and may want to space out the frequency. */ REFRESH MATERIALIZED VIEW mv_staff;
ALTER TABLE BEHANDLING ADD COLUMN overstyrt_endringstidspunkt TIMESTAMP(3);
-- PROGRESSION 1: create table city( id number(11), name varchar(50) ); --1. Insert into city Insert into city(id,name)values(1,'india'); select * from city; --2. Insert into referee insert into referee(id,name)values(2,'john'); --3. Insert into innings --4. Insert into extra_type --5. Insert into skill --6. Insert into team --7. Insert into player --8. Insert into venue --9. Insert into event --10. Insert into extra_event --11. Insert into outcome --12. Insert into game --13. Update player table --14. Update player table --15. Update player table --16. Update player table --17. Delete from extra_type --18. Delete from referee --19. Delete from player --20. Delete from outcome
create table ALIEN(aid int, aname varchar(100)); insert into ALIEN values(101,'ram'); insert into ALIEN values(102,'pavan'); insert into ALIEN values(103,'ing'); insert into ALIEN values(104,'tcs'); insert into ALIEN values(105,'iiit');
/* Name: Information external Leads Data source: 4 Created By: Admin Last Update At: 2015-11-16T19:42:46.730669+00:00 */ SELECT string(STRFTIME_UTC_USEC(DATE(date), "%m/%d/%Y")) AS date, b.Email AS Email_Address, b.Subject AS Subject, b.development_id AS Development_id, b.listing_id AS listing_id, Hier_List.marketingGroup_name AS Marketing_Group, Hier_List.marketingGroup_id AS MG_id, Lis_Det.street_address AS Street_address, Lis_Det.City AS City, Lis_Det.zip_code AS ZipCode, Lis_Det.country AS Country, b.contact_Name AS Contact_Name, b.contact_email AS Email, b.contact_phone Phone, NTH(2, SPLIT(regexp_replace(string(text),'\n',' '), '>')) AS Inquiry, STATE AS Status, Tags, Opens, Clicks FROM [djomniture:devspark.MG_Leads] b JOIN (SELECT string(id) AS id FROM [djomniture:devspark.MG_Listings] where DATE(created_at) <= DATE('{{enddate}}')) AS Listing ON b.Listing_id = Listing.id LEFT OUTER JOIN [djomniture:devspark.MG_Listing_Address] AS Lis_Det ON b.Listing_id = Lis_Det.id LEFT OUTER JOIN [djomniture:devspark.MG_Hierarchy_Listing] AS Hier_List ON Lis_Det.id = Hier_List.listing_id WHERE date(date) >= DATE('{{startdate}}') AND date(date) <= DATE('{{enddate}}') AND string('{{mgid}}') = Hier_List.marketingGroup_id ORDER BY date DESC
-- En el salón de Musimundos tenemos un cliente fanático de Willie Dixon, quiere comprar toda la colección de sus temas pero no le interesan los temas que sean de su etapa en el rock. Hagamos una consulta en la base de datos donde te muestre todos los registros que contengan canciones con sus géneros Y que el compositor sea Willie Dixon Y que tengan el género Blues. -- Ingresá el nombre de la segunda canción que obtuviste. SELECT c.nombre, g.nombre FROM canciones c, generos g WHERE g.nombre = 'Blues' AND c.compositor = 'Willie Dixon'; -- Rta: Pretty Baby
drop table Universitate cascade constraints; drop table Student cascade constraints; drop table Aplica cascade constraints; create table Universitate(uNume varchar(20), oras varchar(20), inscrieri int); create table Student(sID int, sNume varchar(20), medie real, dimLiceu int); create table Aplica(sID int, uNume varchar(20), specializare varchar(20), decizie char(2) check (decizie in ('DA','NU'))); delete from Student; delete from Universitate; delete from Aplica; insert into Student values (123, 'Ioana', 9.90, 1000); insert into Student values (234, 'Bogdan', 9.66, 1500); insert into Student values (345, 'Cristian', 9.50, 500); insert into Student values (456, 'Dorina', 9.90, 1000); insert into Student values (567, 'Eduard', 7.90, 2000); insert into Student values (678, 'Florin', 9.80, 200); insert into Student values (789, 'George', 9.40, 800); insert into Student values (987, 'Elena', 9.70, 800); insert into Student values (876, 'Irina', 9.90, 400); insert into Student values (765, 'Ioan', 7.90, 1500); insert into Student values (654, 'Ioana', 9.90, 1000); insert into Student values (543, 'Cristian', 9.40, 2000); insert into Universitate values ('Cuza', 'Iasi', 15000); insert into Universitate values ('Petre Andrei', 'Iasi', 36000); insert into Universitate values ('Spiru Haret', 'Bucuresti', 10000); insert into Universitate values ('Babes-Bolyai', 'Cluj', 21000); insert into Aplica values (123, 'Cuza', 'Informatica', 'DA'); insert into Aplica values (123, 'Cuza', 'Fizica', 'NU'); insert into Aplica values (123, 'Petre Andrei', 'Informatica', 'DA'); insert into Aplica values (123, 'Babes-Bolyai', 'Fizica', 'DA'); insert into Aplica values (234, 'Petre Andrei', 'Biologie', 'NU'); insert into Aplica values (345, 'Spiru Haret', 'Bioinginerie', 'DA'); insert into Aplica values (345, 'Babes-Bolyai', 'Bioinginerie', 'NU'); insert into Aplica values (345, 'Babes-Bolyai', 'Informatica', 'DA'); insert into Aplica values (345, 'Babes-Bolyai', 'Fizica', 'NU'); insert into Aplica values (678, 'Cuza', 'Istorie', 'DA'); insert into Aplica values (987, 'Cuza', 'Informatica', 'DA'); insert into Aplica values (987, 'Petre Andrei', 'Informatica', 'DA'); insert into Aplica values (876, 'Cuza', 'Informatica', 'NU'); insert into Aplica values (876, 'Spiru Haret', 'Biologie', 'DA'); insert into Aplica values (876, 'Spiru Haret', 'Biologie', 'NU'); insert into Aplica values (765, 'Cuza', 'Istorie', 'DA'); insert into Aplica values (765, 'Babes-Bolyai', 'Istorie', 'NU'); insert into Aplica values (765, 'Babes-Bolyai', 'Psihologie', 'DA'); insert into Aplica values (543, 'Spiru Haret', 'Informatica', 'NU');
ALTER TABLE `elearning`.tc_homework ADD COLUMN collect_by VARCHAR(64) NULL COMMENT '收作业人' AFTER qa_count, ADD COLUMN collect_date DATETIME NULL COMMENT '收作业时间' AFTER collect_by ;
\c workouts_db INSERT INTO exercises(name, date, reps, sets) VALUES ('Squats', '01/21/2022', 8, 3), ('Bench Press', '01/21/2022', 8, 3), ('Rows', '01/21/2022', 8, 3), ('Deadlifts', '01/23/2022', 8, 3), ('Pull-Ups', '01/24/2022', 8, 3), ('Shoulder Press', '01/24/2022', 8, 3), ('Push-Ups', '01/24/2022', 8, 3);
/* MVP */ /* Q1 */ SELECT * FROM employees WHERE department = 'Human Resources'; /* Q2 */ SELECT first_name, last_name, country FROM employees WHERE department = 'Legal'; /* Q3 */ SELECT COUNT(*) FROM employees WHERE country = 'Portugal'; /* Q4 */ SELECT COUNT(*) FROM employees WHERE country = 'Portugal' OR country = 'Spain'; /* Q5 */ SELECT COUNT(*) FROM pay_details WHERE local_account_no IS NULL; /* Q6 */ SELECT * FROM pay_details WHERE local_account_no IS NULL AND iban IS NULL; /* Q7 */ SELECT first_name, last_name FROM employees ORDER BY last_name ASC NULLS LAST /* Q8 */ SELECT first_name, last_name, country FROM employees ORDER BY country ASC NULLS LAST, last_name ASC NULLS LAST; /* Q9 */ SELECT * FROM employees ORDER BY salary DESC NULLS LAST LIMIT 10; /* 10 */ SELECT first_name, last_name, salary FROM employees WHERE country = 'Hungary' ORDER BY salary ASC NULLS LAST; /* 11 */ SELECT * FROM employees WHERE first_name LIKE 'F%'; /* 12 */ SELECT * FROM employees WHERE email LIKE '%yahoo%'; /* 13 */ SELECT * FROM employees WHERE pension_enrol = TRUE AND (country != 'France' OR country != 'Germany'); /* 14 */ SELECT * FROM employees WHERE department = 'Engineering' AND fte_hours = '1' ORDER BY salary DESC NULLS LAST LIMIT 1; /* 15 */ SELECT first_name, last_name, fte_hours, salary, fte_hours * salary AS effective_yearly_salary FROM employees; /* EXTENSION */ /* 16 */ SELECT first_name, last_name, department, CONCAT(first_name, ' ', last_name, ' - ', department) AS badge_label FROM employees WHERE first_name IS NOT NULL AND last_name IS NOT NULL AND department IS NOT NULL; /* 17 */ SELECT first_name, last_name, department, start_date, CONCAT( first_name, ' ', last_name, ' - ', department, ' (joined ', TO_CHAR(start_date, 'FMMonth FMYYYY'), ')' ) AS badge_label_date FROM employees WHERE first_name IS NOT NULL AND last_name IS NOT NULL AND department IS NOT NULL AND start_date IS NOT NULL; /* 18 */ SELECT first_name, last_name, salary, CASE WHEN salary IS NULL THEN NULL WHEN salary < 40000 THEN 'low' WHEN salary >= 40000 THEN 'high' END AS salary_class FROM employees;