首页 > 数据库技术 > 详细

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

时间:2020-02-05 01:06:28      阅读:61      评论:0      收藏:0      [点我收藏+]

联表查询:

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;

 

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!