在create table语句中间放置注释?可能吗?
是的,可以使用#符号。让我们首先创建一个表-
mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY , # Creating a sequence Number -> FirstName varchar(20), # Creating a column to store name -> Age int # creating a column to store an age -> );
上面,我们使用#符号设置了注释。使用insert命令在表中插入一些记录。我们还将在插入语句中使用相同的#符号设置注释-
mysql> insert into DemoTable(FirstName,Age) values('Chris',21);
mysql> insert into DemoTable(FirstName,Age) values('David',23); # Inserting to store Firstname and age.
mysql> insert into DemoTable(FirstName,Age) values('Bob',24); # Inserting to store Firstname and age.使用select语句显示表中的所有记录-
mysql> select *from DemoTable;
这将产生以下输出-
+----+-----------+------+ | Id | FirstName | Age | +----+-----------+------+ | 1 | Chris | 21 | | 2 | David | 23 | | 3 | Bob | 24 | +----+-----------+------+ 3 rows in set (0.00 sec)
热门推荐
10 祝女儿简短祝福语大全
11 大学新年祝福语简短创意
12 元旦适合的祝福语简短
13 朋友出远门祝福语简短
14 初六简短的祝福语
15 祝男孩生日祝福语简短
16 同事调离的祝福语简短
17 拜年红包的祝福语简短
18 妈妈生日祝福语简短励志