开始Mysql(建表)2

drop   table   if   exists  T_User;
create   table  T_User(
id 
int   primary   key  AUTO_INCREMENT,
U_uid 
varchar ( 50 ),
U_pwd 
varchar ( 20 ),
U_name 
varchar ( 20 )
);
/* insert into T_User values('admin','123','管理员1'); */
insert   into  T_User(U_uid,U_pwd,U_name)  values ( ' admin ' , ' 123 ' , ' 管理员1 ' );
insert   into  T_User(U_uid,U_pwd,U_name)  values ( ' bb ' , ' 123 ' , ' 管理员2 ' );
insert   into  T_User(U_uid,U_pwd,U_name)  values ( ' bb ' , ' 123 ' , ' 管理员2 ' );
update  T_User  set  U_name = ' 管理员bbb '    where  id = 1 ;
delete   from  T_User  where  id  = 3 ;
select   *   from  T_User;

注意:如果要让自动增长列自动递增就必须指定其他列名

 insert into T_User values('admin','123','管理员1')

这样就会添加失败。

 用--可以注释代码 但是必须后面加一个空格 不然会报错   也可以用/**/

你可能感兴趣的:(mysql)