发表于: 2017-05-25 16:11:12
3 1256
今天才算真正的写日报,有格式,有感想。
今天完成的事情:练习任务一的1到10步。
建立业务表
每个表都需要一个主键,本表主键要自增,其中的qq号、预计入学时间、毕业院校、立愿、辅导师兄和从何处了解到修真院这几个字段我觉得允许为空。
qq、修真类型、毕业院校、学号、时报链接、立愿、师兄、从何了解这几个字段都和其他字段可以是1对多的关系。
创建业务表时还试了用sql语句创建:
create table sign_up2
(
id bigint not null auto_increment,
creat_at datetime not null default Current_timestamp comment '创建时间',
update_at TIMESTAMP not null default current_timestamp on update current_timestamp comment '更新时间',
name varchar(10) not null,
qq varchar(30),
type varchar(20) not null,
join_time date,
university varchar(40),
student_id varchar(20) not null,
report_link varchar(255) not null,
comment varchar(255),
teacher varchar(30),
where_get varchar(30),
primary key (id)
)
另外用sql语句练习了插入、更新、索引(我觉得还应给修真类型、学号、入学时间建索引)
insert into sign_up
(
name,
qq,
type,
join_time,
university,
student_id,
report_link,
comment,
teacher,
where_get
)
values
(
'童志荣',
'602840329',
'java工程师',
'2017-05-08',
'上海应用技术学院',
'Java-1827',
'https://www.jnshu.com/daily/22019?uid=11081',
'3个月后拿到offer',
'成都分院_李昂',
'知乎'
)
update sign_up
set comment='老大没我帅',
where_get='测试'
where name='童志荣'
create index nameindex
on sign_up3
(
name
)
明天计划的事情:看了看深度思考中的问题,发现我又被卡住了,这是明天的任务。
遇到的问题:主键怎么设置成自动递增、 creat_at、update_at怎么自动生成数据、使用插入命令最好用那种明确列名的格式,不要用全部插入。这些都通过baidu和师兄弟的日报学习了。
另外插入10条数据后建立索引,没发现和不建立索引有啥效率问题啊,因为我也不知道咋看效率,看执行时间吗?都是0.001秒啥的。求教师兄怎么看。
收获:每个表要有主键和3个基本字段,日期类型的字段也要用单引号括起来。插入数据必须要有所有不能为空的字段明细。
评论