mysql日常小总结(其实就今天)

时间:2020-02-05 01:06:28   收藏:0   阅读:62

联表查询:

SELECT t1.user_Name  FROM t_user AS t1   ,  t_comment AS t2 WHERE t2.user_id=t1.id 

结果如图:

技术分享图片

 

 

 加上GROUP BY user_name(SELECT t1.user_Name  FROM t_user AS t1   ,  t_comment AS t2 WHERE t2.user_id=t1.id GROUP BY user_name)

如图:

技术分享图片

 

 GROUP BY的作用很明显了吧

-----------------------------------------

更新:

UPDATE t_comment SET state =1

UPDATE t_article SET index_state = 0  WHERE id <= 50

 

 

删除表的某一列:

ALTER TABLE t_article DROP COLUMN index_state;

 

原文:https://www.cnblogs.com/share-record/p/12261997.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!