zoukankan      html  css  js  c++  java
  • 常用sql

    一.基础

    create/drop  database dbname / table tbname(新建/删除数据库、表)

    alter table tbname add 字段名 类型

    create  index indexname on tbname(字段名) 创建索引

    drop index indexname 删除索引

    增删改查:

    insert into tbname (字段a,字段b) values(a,b)

    delete from tbname where id ='1'

    update table set 字段= a where id=‘1’

     select * from tbname

    count,sum,avg,max,min

    select distinct * from tbname order by id desc 去重复、倒序

    筛选条件 where and ,having,group by,in,not in,not exists, select top 10 * from tbname,随机select newid(),order by newid()

    多表查询

    select * from tba a left join tbb b on a.id=b.id

    right join on

    select * from tba where a in (select * from tbb)

  • 相关阅读:
    JSON和Object数组在js中的转换
    Raphael绘制箭头arrow
    Web后台框架开发
    数据库开发
    docker
    git
    linux
    正则表达式工具
    python模拟ls命令
    python3基础
  • 原文地址:https://www.cnblogs.com/oo-llm/p/12439107.html
Copyright © 2011-2022 走看看