/*
2 创建管家婆的数据库
3 名字 gjp
4 */
5 CREATE DATABASE gjp;
6
7 USE gjp;
8
9 /*
10 创建数据表,表名账务
11 字段,列
12 主键
13 分类名称 可变字符
14 金额 double
15 账户 可变字符 (支付,收入方法)
16 创建日期 date
17 账务描述 可变字符
18 */
19
20 CREATE TABLE gjp_zhangwu(
21 -- 主键
22 zwid
INT PRIMARY KEY AUTO_INCREMENT,
23 -- 分类名称
24 flname
VARCHAR(
200),
25 -- 金额
26 money DOUBLE,
27 -- 账户
28 zhanghu
VARCHAR(
100),
29 -- 创建日期
30 createtime DATE,
31 -- 账务描述
32 description
VARCHAR(
1000)
33 );
34 SELECT * FROM gjp_zhangwu
35
36 -- 写入测试的数据
37 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
1,
‘吃饭支出‘,
247,
‘交通银行‘,
‘2016-03-02‘,
‘家庭聚餐‘);
38 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
2,
‘工资收入‘,
12345,
‘现金‘,
‘2016-03-15‘,
‘开工资了‘);
39 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
3,
‘服装支出‘,
1998,
‘现金‘,
‘2016-04-02‘,
‘买衣服‘);
40 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
4,
‘吃饭支出‘,
325,
‘现金‘,
‘2016-06-18‘,
‘朋友聚餐‘);
41 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
5,
‘股票收入‘,
8000,
‘工商银行‘,
‘2016-10-28‘,
‘股票大涨‘);
42 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
6,
‘股票收入‘,
5000,
‘工商银行‘,
‘2016-10-28‘,
‘股票又大涨‘);
43 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
7,
‘工资收入‘,
5000,
‘交通银行‘,
‘2016-10-28‘,
‘又开工资了‘);
44 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
8,
‘礼金支出‘,
5000,
‘现金‘,
‘2016-10-28‘,
‘朋友结婚‘);
45 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
9,
‘其他支出‘,
1560,
‘现金‘,
‘2016-10-29‘,
‘丢钱了‘);
46 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
10,
‘交通支出‘,
2300,
‘交通银行‘,
‘2016-10-29‘,
‘油价还在涨啊‘);
47 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
11,
‘吃饭支出‘,
1000,
‘工商银行‘,
‘2016-10-29‘,
‘又吃饭‘);
48 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
12,
‘工资收入‘,
1000,
‘现金‘,
‘2016-10-30‘,
‘开资‘);
49 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
13,
‘交通支出‘,
2000,
‘现金‘,
‘2016-10-30‘,
‘机票好贵‘);
50 INSERT INTO gjp_zhangwu(zwid,flname,
money,zhangHu,createtime,description)
VALUES (
14,
‘工资收入‘,
5000,
‘现金‘,
‘2016-10-30‘,
‘又开资‘);
Java数据库练习02--管家婆项目
标签:-- mysql des pool incr 语言 src java数据库 data