上篇展示了如何使用MyBatis执行创建操作表。本章将告诉你如何使用MyBatis来读取表。我们已经在MySQL下有EMPLOYEE表:1 CREATE TABLE EMPLOYEE (2 id INT NOT NULL auto_increment,3 first_name VARCH...
分类:
其他好文 时间:
2015-07-27 22:50:15
阅读次数:
198
建表:(not null ,auto_increment, unique , primary key)create database balfish;use balfish;create table mytable1( id int not null, name varchar(20), grade...
分类:
数据库 时间:
2015-07-27 14:41:24
阅读次数:
138
MyBaits一对一的查询方法一:表数据与表结构CREATE TABLE teacher(t_id INT PRIMARY KEY AUTO_INCREMENT,t_name VARCHAR(20));CREATE TABLE class(c_id INT PRIMARY KEY AUTO_INCR...
分类:
其他好文 时间:
2015-07-26 12:26:44
阅读次数:
266
sql命令:alter table tbl_name change old_col_name new_col_name data_type not null auto_increment primary key案例如下:修改前的表结构 查询表结构的命令:desc table_name;修改后的表结....
分类:
数据库 时间:
2015-07-25 19:48:16
阅读次数:
175
1. 插入记录INSERT
方法一:
INSERT [INTO] tbl_name [(clo_name,...)] {VALUES | VALUE} ({expr | DEFAULT},...),(...),...;
例如:
CREATE TABLE users(id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, username VARCH...
分类:
数据库 时间:
2015-07-23 21:58:34
阅读次数:
153
;CREATE TABLE TabTest ( `id` INT(11) NOT NULL AUTO_INCREMENT ,`factorA` VARCHAR(255) NOT NULL DEFAULT ' ' ,`factorB` VARCHAR(255) NOT NULL DEFAULT ' '...
分类:
数据库 时间:
2015-07-23 21:11:24
阅读次数:
158
给表添加外键必须满足2个条件,1,该表的引擎必须是InnoDB,2,必须给要添加外键的字段建立索引 create table child( cid int not null auto_increment primary key, pid int, key pid(pid), cname varcha...
分类:
其他好文 时间:
2015-07-23 07:01:01
阅读次数:
133
UNIONUNION ALL//Table AttributeCreate table student( id int unsigned not null auto_increment, name varchar(20) not null, primary key(id))ENGINE=I...
分类:
其他好文 时间:
2015-07-20 19:25:37
阅读次数:
125
mybatis版本 : 3.2.8 其实很简单,之前想复杂了。。。 mybatis插入自增id的记录后,传入的POJO会自动更新id的值为插入后的结果 (目前只测了id,其他字段如果不给定值,不知是否更新,有待测试) 记录如下: Us...
分类:
数据库 时间:
2015-07-18 12:46:03
阅读次数:
366
首先在监控服务器上创建一个数据库monitor:mysql -h172.16.150.23 -uroot -proot
create database monitor;
use monitor;
mysql> create table servers (
id int not null primary key auto_increment,
hostname...
分类:
Web程序 时间:
2015-07-16 20:03:54
阅读次数:
241