已采纳回答 / 有梦想的人不睡觉11
CREATE FUNCTION ADD_USER(p_id SMALLINT,username VARCHAR(20)) RETURNS INT UNSIGNED BEGIN INSERT user(p_id,username) VALUES(p_id,username); RETURN LAST_INSERT_ID(); END
2018-08-08
老师讲得很好好详细,只是如果按照老师的排版和进度,做起笔记比较吃力.............................估计是要添加索引了.......
2018-08-07
子查询:
UPDATE tdb_goods SET goods_cate = (SELECT cate_id FROM tdb_goods_cates WHERE tdb_goods.goods_cate = cate_name)
添加外键约束:
ALTER TABLE tdb_goods ADD CONSTRAINT fk_tdb_goods_goods_cate FOREIGN KEY fk_tdb_goods_cates(goods_cate) REFERENCES tdb_goods_cates(cate_id) ON UPDATE CASCADE ON DELETE CASCADE
UPDATE tdb_goods SET goods_cate = (SELECT cate_id FROM tdb_goods_cates WHERE tdb_goods.goods_cate = cate_name)
添加外键约束:
ALTER TABLE tdb_goods ADD CONSTRAINT fk_tdb_goods_goods_cate FOREIGN KEY fk_tdb_goods_cates(goods_cate) REFERENCES tdb_goods_cates(cate_id) ON UPDATE CASCADE ON DELETE CASCADE
最赞回答 / wumu_zhuangzhu
我也遇到这个问题,不过是mysql配置的问题,我把解决办法贴出来给遇到同样错误的人作一些参考ERROR 1055 (42000): Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.s....
2018-08-02