• mysql


    1.创建数据库samp_db

    create database samp_db character set gbk;

    2.插入

    insert into students (name, sex, age) values("孙丽华", "女", 21);

    3.查询

    查询年龄在21岁以上的所有人信息: select * from students where age > 21;

    查询名字中带有 "王" 字的所有人信息: select * from students where name like "%王%";

    查询id小于5且年龄大于20的所有人信息: select * from students where id<5 and age>20;

    4.修改列

    将表 tel 列改名为 telp:honealter table students change tel telphone char(13) default "-";

    将 name 列的数据类型改为 char(16): alter table students change name name char(16) not null;

    5.删除

    删除 birthday 列: alter table students drop birthday;

    删除 workmates 表: drop table workmates;

    删除 samp_db 数据库: drop database samp_db;

    6.重命名

    重命名 students 表为 workmates: alter table students rename workmates;

  • 相关阅读:
    Roadblocks(poj 3255)
    最小集合(51nod 1616)
    绿色通道(codevs 3342)
    解的个数(codevs 1213)
    多米诺(codevs 3052)
    abcd
    dwarf tower
    第K 小数
    noip2016复习
    文化之旅(洛谷 1078)
  • 原文地址:https://www.cnblogs.com/lixuemin/p/5209938.html
Copyright © 2020-2023  润新知