zoukankan      html  css  js  c++  java
  • mysql数据库的增删改查

    数据表:
    增加列:
    alter table 数据表名 add birthday datetime;

    改:
    1.修改字段,不重命名,用modify
    alter table 数据表名 modify birthday date;

    2.修改字段,重命名,用change
    alter table 表名 change 原名 新名 类型及约束
    alter table 数据表名 change birthday birth date;

    删:
    alter table 表名 drop 列名;

    枚举中的下标从1开始,对应枚举

    数据:

    增:
    insert into xxxx values(1,"1996-10-03","傻子");
    部分插入:
    insert into 表名(列1,...) values(值1,...);


    改:
    update 表名 set 列名=x where 条件;
    例:update xxxx set name="小燕" where birth="1998-03-26";

    查:
    查询表使用数据 select * from 表名;
    部分查询 select * from 表名 where 条件;

    可以使用as 为列表指定别名
    select 字段 as 别名,字段 as 别名 from 数据表名 where...;

    删:
    delete from 数据表名 where ...;

  • 相关阅读:
    [Scoi2010]游戏
    HDU3415(单调队列)
    POJ1221(整数划分)
    POJ1050(dp)
    POJ2479(dp)
    HDU1864(背包)
    HDU1175(dfs)
    STL_string.vector中find到的iterator的序号
    Qt532.数值转为16进制(并填充)
    异常处理.VC++
  • 原文地址:https://www.cnblogs.com/zhongxiaoyan/p/12353262.html
Copyright © 2011-2022 走看看