在SQL中是否需要分号? [英] Is the semicolon necessary in SQL?

查看:240
本文介绍了在SQL中是否需要分号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,如果我忘记了;,它仍然可以正常工作.但有时并非如此.

Sometimes it works anyway if I forget the ;. But sometimes it doesn't.

在JDBC和Android SQLite中,似乎根本不需要;.我很困惑.

And in JDBC and Android SQLite, it seems that I don't need ; at all. I am confused.

我什么时候应该使用分号?

When should I use a semicolon?

推荐答案

分号表示一条语句的结尾,因此,如果有多个语句,则应使用分号,否则它将很好地工作.

semicolon indicates end of a statement, so if there are multiple statements then you should use semicolon else it will work fine.

我通常使用分号作为练习,即使在sql客户端上运行查询时它也很有用,例如如果您在工作表上有多个语句,则在Sql Developer中使用分号非常有帮助,因为您可以简单地转到该特定语句并使用F9执行该语句,而不能使用分号.

I generally use semicolon as a practice, it can be useful even when you are running queries on sql client e.g. in Sql Developer using semicolon is very helpful if you have multiple statements on worksheet, as you can simply go to that particular statement and use F9 to execute that, without semicolon this is not possible.

这篇关于在SQL中是否需要分号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆