zoukankan      html  css  js  c++  java
  • MySQL数据库(增删查改)

    创建一个表:
    create table user(
    uid varchar(10) ,
    pwd int(10)
    );
    学生表:
    create table student(
    sno varchar(20) not null primary key comment '学号' ,
    sname varchar(20) not null comment '学生姓名' ,
    ssex varchar(20) not null comment '学生性别' ,
    sbirthday datetime comment '学生出生年月' ,
    class varchar(20) comment '学生所在班级'

    );
    课程表:
    create table course(
    con varchar(20) not null primary key comment '课程号' ,
    cname varchar(20) not null comment '课程名称' ,
    ton varchar(20) not null comment '教工编号'

    );
    成绩表:
    create table score(
    id int primary key auto_increment,
    sno varchar(20) not null comment '学号' ,
    con varchar(20) not null comment '课程号' ,
    degree decimal(4,1) not null comment '成绩'

    );
    教师表:
    create table teacher(
    tno varchar(20) not null primary key comment '教工编号',
    tname varchar(20) not null comment '教工姓名',
    tsex varchar(20) not null comment '教工性别' ,
    tbirthday datetime comment '教工出生年月' ,
    prof varchar(20) comment '职称',
    depart varchar(20) not null comment '教工所在部门'
    );

    插入数据:
    use z_0705;
    set names gbk;
    insert into students1 values
    ('108','曾华','男','1977-09-01','95033'),
    ('105','匡明','男','1975-10-02','95031'),
    ('107','王丽','女','1976-01-23','95033'),
    ('101','李军','男','1976-02-20','95033'),
    ('109','王芳','女','1975-02-10','95031'),
    ('103','陆君','男','1974-06-03','95031');

    desc students1 查看表结构
    select * from students1 查看表里的数据
    show create table students1:查看表的具体信息

    drop databases 数据库名;

    drop table 表名;

    use 数据库名 ;进入数据库

  • 相关阅读:
    java生成二维码
    关于使用QRcode.jar生成二维码
    sun.misc.BASE64Encoder找不到jar包的解决方法
    perl 调用方法 子例程说明
    perl 访问类方法的几种方式
    perl use base 代替 @ISA
    perl 为什么要用引用来做对象呢?
    12.5.3 UNIVERSAL:最终的祖先类:
    Informix9客户端工具Server Studio JE乱码的解决方法
    perl 使用SUPER类来访问覆盖的方法
  • 原文地址:https://www.cnblogs.com/awdsjk/p/9481255.html
Copyright © 2011-2022 走看看