zoukankan      html  css  js  c++  java
  • 数据库内容总纲

    1.创建数据库
    create database 数据库名称
    删除数据库
    drop database 数据库名称

    2.创建表
    create table 表名
    (
    列名 类型(长度) 自增长 主键 非空,
    )
    自增长:auto_increment
    主键:primary key
    非空:not null
    外键:foreign key 列名 references 表名(列名)

    删除表
    drop table 表名

    3.CRUD操作

    insert into 表名 values(值)
    insert into 表名(列名) values(值)

    delete from 表名 where 条件

    update 表名 set 列名=值 where 条件

    select * from 表名
    select 列名 from 表名
    select * from 表名 where 条件
    select * from 表名 where 条件1 or 条件2
    select * from 表名 where 列名 like '%值%'
    select * from 表名 where 列名 between A and B
    select * from 表名 where 列名 in(值)
    select * from 表名 limit n,m
    select * from 表名 order by 列名 desc
    select * from 表名 group by 列名 having 条件
    select count(*) from 表名
    select sum(列名) from 表名
    select avg(列名) from 表名
    select max(列名) from 表名
    select min(列名) from 表名
    select distinct 列名 from 表名

    高级查询:
    1.连接查询
    select * from 表1,表2 where 连接条件
    select * from 表1 join 表2 on 连接条件

    2.联合查询
    select 列名 from 表1
    union
    select 列名 from 表2

    3.子查询
    无关子查询
    子查询和父查询没有关系,子查询可以单独执行
    select * from 表 where 列=(select 列 from 表)
    相关子查询
    子查询和父查询存在互相的关系,子查询需要用到父查询的内容

  • 相关阅读:
    应用六:Vue之父子组件间的三种通信方式
    应用五:Vue之ElementUI 表格Table与分页Pagination组件化
    应用四:Vue之VUEX状态管理
    Vue 中使用 sass 或 scss 语法配置
    Sass 中文注释导致编译错误
    Sass 的安装及命令行使用
    video 标签
    原生JS添加删除Class
    HTML5 面试选题
    CSS 常用属性初始化标签名
  • 原文地址:https://www.cnblogs.com/zxl89/p/5983785.html
Copyright © 2011-2022 走看看