zoukankan      html  css  js  c++  java
  • 常用数据库操作代码

    初始化

    DROP TABLE IF EXISTS `aaabbb`;
    CREATE TABLE `aaabbb` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` char(20) NOT NULL DEFAULT '' COMMENT '站点名称',
    `url` varchar(255) NOT NULL DEFAULT '',
    `alexa` int(11) NOT NULL DEFAULT '0' COMMENT 'Alexa 排名',
    `country` char(10) NOT NULL DEFAULT '' COMMENT '国家',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

    增加
    INSERT `aaabbb` VALUES (2,3,4,5,6); / INSERT into `aaabbb` VALUES (2,3,4,5,6);

    删除
    delete from `aaabbb` where id=1;

    修改
    UPDATE `aaabbb` set country='china' where country='CN';


    排序 (默认 asc 升序 - 不加 ,desc:降序)
    SELECT * FROM `capital_order_base_copy1` order by created_date asc

    限制
    SELECT * FROM `capital_order_base` where true limit 10
    SELECT * FROM `capital_order_base` limit 10

    先排序后筛选
    SELECT * FROM `capital_order_base_copy1` ORDER BY created_date desc limit 3

    选择唯一的 bank_name 和 bank_updatetime
    SELECT distinct bank_name,bank_updatetime FROM bank_all_info_copy1;

  • 相关阅读:
    webpack-bundle-analyzer使用
    HTTP1.0,HTTP1.1和HTTP2.0区别
    document.readyState
    async和defer
    页面生命周期
    key的理解
    解释型语言和编译型语言
    AMD/CMD/CommonJS与ES6 Module的区别
    vue的keep-alive原理
    数字钱包metaplex-foundation
  • 原文地址:https://www.cnblogs.com/justSmile2/p/11721527.html
Copyright © 2011-2022 走看看