
其中这是方式基本上每个数据库都是支持的mysql 注释方法
在MySQL中病支持标准的"--"注释方式,他采用的是"#"方式才进行单行注释。
1."#"注释. 以#开头的一句表示注释一行如:
#
##创建用户表
#
create table user(
id int primary key not null,
name varchar(20))
#注释也可以用在行中注释,注释从#开始,到行末结束.如:
create table user(
id int primary key not null, # 用户id
name varchar(20))2.这种是C语言的注释风格,支持一行注释也支持多行注释。另外还可以是行内注释
1) 单行注释 即用注释一行如
create table student(
id int primary not null,
name varchar(50))
2)多行注释 即可以跨行注释如
create table student(
id int primary not null,
name varchar(50))
3)行内注释 即注释的内容可以在sql语句中,可以用来对字段进行注释。如:
create table student(
id int ,name varchar(50) )SqlServer 注释方法
--注释,即标准的单行注释
--
----创建用户表
--
create table student(
id int primary not null,
name varchar(50))
注释:用法同MySQL的注释方式,支持单行,多行和行内注释。Oracle和DB2数据库的注释方式基本上和SqlServer相同,参见上面。
一、多行注释
与C语言相同的程序注释符号,即“/**/”。“/*”用于注释文字的开头,“*/”用于注释文字的结尾,可在程序中标识多行文字为注释。
二、格式:/*注释内容*/。
例子:
DECLARE @myvariable DATETIME
1、The following statements retrieve the current date and time and extract the day of the week from the results.
2、SELECT @myvariable=GETDATE()。
SELECT DATENAME(dw,@myvariable)。
扩展资料:
一、单行注释
1、ANSI 标准的注释符“--” 用于单行注释,格式:--注释内容。
2、例子:
use pangu-- 使用名为pangu的数据库。
declare@startdate datetime。
set@startdate=‘1/1/2000’。
select‘Start Date:’+convert(varchar(12)@startdate)。
convert()函数用于转换数据类型。
注意这里的注释'--'符号后需要一个空格,注释才生效。
参考资料来源:
百度百科-sql注释
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)