MySQL 函数有哪些?
我使用 Navicat for MySQL 并且看到“函数”。它们是如何使用的?这些是什么?他们的主要目的是什么?
I use Navicat for MySQL and I see "functions". How they are used? What are they? What is their main purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 SQL 中,函数是在数据库内部定义的子程序。它们基本上是可以从 SQL 语句内部调用的函数,其用途与调用其他语言中的函数的用途相同。大多数 SQL 语言都带有一些简单的重要函数,并且可以添加用户定义的函数。例如,MySQL 包含函数 count()。可以这样调用:
这将计算 some_table 表的 some_column 列中的行数。您将得到类似以下的响应:
SQL 函数类似于 SQL 中的存储过程,但不同之处在于:
您可以在此处找到有关函数和存储过程的更多信息:
http://www.w3schools.com/ sql/sql_functions.asp
http://en.wikipedia.org/wiki/User -defined_function
http://dev.mysql.com/ doc/refman/5.0/en/functions.html
有什么意义存储过程?
http://en.wikipedia.org/wiki/Stored_procedure
In SQL functions are subprograms defined inside the database. They are basically functions that can be called from inside SQL statements, and are useful for the same reasons that calling functions in other languages are useful. Most SQL languages come with some simple important functions and user defined functions can be added. For example, MySQL contains the function count(). It can be called like so:
This will count the number of rows that are in the some_column column of the some_table table. You will get a response something like:
SQL functions similar to, but different from stored procedures in SQL for these reasons:
You can find more information about functions and stored procedures here:
http://www.w3schools.com/sql/sql_functions.asp
http://en.wikipedia.org/wiki/User-defined_function
http://dev.mysql.com/doc/refman/5.0/en/functions.html
What's the point of a stored procedure?
http://en.wikipedia.org/wiki/Stored_procedure