天天看点

SQL建表,包含主键,自增ID,默认值,字段注释,表注释#创建数据表SQL语句#修改表注释

#创建数据表SQL语句

我这里是python

sql= '''
    create table test_users(
        id int primary key not null auto_increment comment 'ID',
        name varchar(100) not null comment '用户名',
        nickname varchar(100) not null comment '昵称',
        password varchar(32) not null comment '密码',
        state int not null default "1" comment '状态,1为正常,0为禁用'
    )
'''
           

#修改表注释

table_sql = '''
    alter table test_users comment='测试用户表';
'''
           
cursor.execute(sql)
cursor.execute(table_sql)
           

作为一名合格的PHP不仅需要好的代码编写能力,还需要掌握服务器相关知识,下面给大家推荐腾讯云搞活动的服务器,刚开始不需要服务器配置太好,纯当练手!点击链接查看官方活动https://cloud.tencent.com/act/cps/redirect?redirect=1067&cps_key=32f906e6e5f3be5e8669b35951da56fc&from=console

继续阅读