数据库笔记

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)

你可能感兴趣的:(数据库笔记)