zoukankan      html  css  js  c++  java
  • 笔记之MySQL创建表create

    创建表
    要求:创建一个教师表teacher,身高保留两位小数
    drop table if exists teacher;                                      (如果存在一个表teacher,删除它;这是避免表名已经存在无法创建新表)


    create table teacher(                                                (创建一个教师表,表名是teacher)


    id int unsigned primary key auto_increment,            (字段id,int unsigned两个单词连起来意思是无符号范围的整数,primary key主键,auto_increment递增)


    name varchar(5),                                                      (字段name,varchar行:字段name,varchar(5)字符串5位)


    age tinyint unsigned,                                                (字段age,tinyint unsigned ,意思是无符号整数,这个范围是(0~255))


    heihgt decimal(5,2)                                                   (字段heihgt,decimal(5,2),解析 总共五位数,小数2位,整数3位)
    )

    需要了解整型、无符号范围、主键、字符串等数据类型

    需要数据可以自己插入(insert into)下面是完整的创建表格的框架:

    drop table if exists teacher;
    create table teacher(
    id int unsigned primary key auto_increment,
    name varchar(5),
    age tinyint unsigned,
    heihgt decimal(5,2)
    )

  • 相关阅读:
    图片懒加载技术
    验证码处理
    基于requests模块的cookie,session和线程池爬取
    最快理解
    Golang
    Django REST framework
    Django REST framework
    Django
    Django
    搭建邮件服务器 Postfix + Dovecot (CentOS)
  • 原文地址:https://www.cnblogs.com/will-wu/p/12717404.html
Copyright © 2011-2022 走看看