+------+------+
| id | no |
+------+------+
| 1 | 1 |
| 11 | 1 |
| 21 | 1 |
+------+------+
Run Code Online (Sandbox Code Playgroud)
我想更新第二行。到 2. 我可以使用的查询是
update test set no = 2 where id = 11;
Run Code Online (Sandbox Code Playgroud)
如果没有 where 子句,我怎么能达到同样的效果??
我在.git/hooks中放了一个名为pre-push.sh的文件
我没有做任何检查,只是想在推送到远程时回应一些错误.以下是.sh文件内容
protected_branch='test'
echo $protected_branch
exit 1
Run Code Online (Sandbox Code Playgroud)
但是它仍然允许推送更改而不会抛出任何错误.需要帮助才能找到我犯错误的地方?
interface c {
state?: {b: string}
}
const x: c = { state: {b: 'c'}}
console.log(x.state.b)
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,在接口c中,state是一个可选属性。
但是,当我想在设置时访问状态对象的属性 b 时,它会给出此错误,对象可能是“未定义”。解决这个问题的正确方法是什么?