2019-08-15 mysql常用语句

1.增删改查示例

    insert into user_table (name,password,age,score) values('张三',"123321",54,5)
    delete from user_table where age=54
    update user_table set password='1234567890123',age=18 where name='ltf'  
    //一定要有where 条件否则所有语句都会被修改
    
SELECT_ROLE_BY_USERID = \
  select role.* from role \
  left join user_role on (role.id = user_role.role_id) \
  where user_role.user_id = ?

SELECT_PERMISSION_BY_USERID = \
  select permission.* from permission \
  left join role_permission on (permission.id = role_permission.permission_id) \
  left join user_role on (role_permission.role_id = user_role.role_id) \
  where user_role.user_id = ?

你可能感兴趣的:(2019-08-15 mysql常用语句)