sql 命令使用简单记录
半个月前就想记下用过的SQL命令的!!!
主题:
按时间查询:
https://blog.csdn.net/hejpyes/article/details/41863349
左关联:
select * from uesrs left join time_entries on users.`id` = time_entries.`users_id`
-用户表关联工时表
去掉相同的值:
select DISTINCT * from uesrs left join time_entries on users.`id` = time_entries.`users_id`
-查询后面加上DISTINCT
显示合并两个列:
CONCAT
删除表格行:
DELETE FROM email_addresses WHERE email_addresses.`id`=56
-指定id删除
更改表数据:
UPDATE tb3 SET tb3.`id`=5 WHERE tb3.`username`='张三'
-改tb3表,名字为‘张三’,把id号改成5