一、准备表新建表mysql> create table department( id int, name varchar(20) );mysql> create table employee( id int primary key auto_increment, 
分类:
数据库 时间:
2018-05-02 21:08:23
阅读次数:
229
CASE表达式中的标量子查询查找部门号为1800的部门ID,地点显示为CANADA,其他显示为USASELECT EMPLOYEE_ID,LAST_NAME,DEPARTMENT_ID, (CASE WHEN DEPARTMENT_ID=(SELECT DEPARTMENT_ID FROM DEPA... ...
分类:
其他好文 时间:
2018-04-27 13:58:47
阅读次数:
139
Mysql 系列文章主页 1 准备数据 1.1 建表 1.1.1 建立 Employee表 1.1.2 建立 Department 表 1.1.3 注意:上述两张表的存储引擎都是 MyISam 1.2 插入数据 2 测试 2.1 给 Employee 表加上写锁 2.2 查询 Employee 表 ...
分类:
数据库 时间:
2018-04-24 17:47:47
阅读次数:
191
Mysql 系列文章主页 本文将以真实例子来讲解小表驱动大表(In,Exists区别) 1 准备数据 1.1 创建表、函数、存储过程 参照 这篇(调用函数和存储过程批量插入数据) 文章中的第 1-7 步,注意,不要执行第8步 1.2 插入数据 现在来执行第8步。 1.2.1 向 Department ...
分类:
其他好文 时间:
2018-04-24 15:33:29
阅读次数:
900
#!/bin/bash#mysql.shmysql=‘mysql-uroot-ptogest‘sql=‘showdatabases;usetogest_sy_department;showtables;‘$mysql-e"$sql"mysql-uroot-ptogest--tee="mysql.log"shell操作mysql
分类:
数据库 时间:
2018-04-24 14:48:18
阅读次数:
174
想要在展示用户数据(from identification)表的同时连接另一个表(department),并且获取对应院系的表名 解决方法: 修改sql语句的写法 通过identification里的d_id与department里d_id的链接名相等获取这个值去实现表之间的链接。详细写法见代码处 ...
分类:
其他好文 时间:
2018-04-19 15:39:55
阅读次数:
123
You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a ne ...
分类:
其他好文 时间:
2018-04-14 13:54:45
阅读次数:
182
内连接 select * from employee inner join department on employee.dep_id = department.id 左连接 在内连接的基础上保留左表记录 select * from employee left join department on ...
分类:
数据库 时间:
2018-03-14 12:53:05
阅读次数:
176
介绍resultMap中使用collection查询集合属性 业务需求,查询部门中的多个人员 public class Department { private Integer id; private String departmentName; private List<Employee> emp ...
分类:
其他好文 时间:
2018-03-12 15:13:45
阅读次数:
222
现假设有如下两个类: class Department(object): def __init__(self, dept_id, name, desc, employees=[]): self.dept_id = dept_id self.name = name self.desc = desc .... ...
分类:
其他好文 时间:
2018-03-11 00:24:08
阅读次数:
174