学习笔记(6):数据分析预科班-创建MySQL表结构与常用字段约束

立即学习:https://edu.csdn.net/course/play/29528/420882?utm_source=blogtoedu

create databese db1; 创建数据库

use db1; 使用数据库

create table  表名 (字段1 类型1 约束1,字段2  类型2 约束2,字段3 类型3 约束3);

create table user1(username varchar(16),age tinyint);

常用字段约束:1、主键自增 primary key auto_increment;2、不能重复 unique ;3、不为空 not null;4、默认值 default 

create table user2(id int primary key auto_increment,username varchar(16) not  null unique,password  varchar(16)  not null,gender tinyint default 0,account decimal(12,2) default 0,vip boolean default 0);

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值