美文网首页
数据库笔记

数据库笔记

作者: zcz19911 | 来源:发表于2017-12-07 11:20 被阅读0次

1、删除一张表(删除后这张表就不能用了,销毁掉的意思)

drop table 表名称

2、删除一张表的数据

delete from 表名称 where 列名称 = 值

3、插入 insert into 表名称

insert into tableA select id as class_id, 1 as grade_id, CURRENT_TIMESTAMP as time from tableB where type = 1;

该语句的意思是先从tableB查找出type值为1的id字段值,然后插入到tableA,tableA的class_id字段等于tableB的id字段,tableA的grade_id字段全部设置为1,tableA的time字段设置为当前时间(格式:2017-12-07 18:29:03)

相关文章

网友评论

      本文标题:数据库笔记

      本文链接:https://www.haomeiwen.com/subject/zsqdixtx.html