选择与选择vs Select Selet之间的区别
两个查询之间有区别吗?俩都正确吗?
SET price = (SELECT buyPrice FROM products WHERE productCode = product);
SELECT buyPrice INTO price FROM products WHERE productCode = product;
Is there a difference between the two queries? Are both correct?
SET price = (SELECT buyPrice FROM products WHERE productCode = product);
SELECT buyPrice INTO price FROM products WHERE productCode = product;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两者都是正确的。
使用
set
语法,您只能一次设置一个变量,因此Select查询在其选择列表中只能具有一个表达式。使用
选择
语法,您可以设置多个变量。例如:Both are correct.
With the
SET
syntax, you can only set one variable at a time, so the SELECT query must have only one expression in its select-list.With the
SELECT INTO
syntax, you can set multiple variables. For example: