zoukankan      html  css  js  c++  java
  • 基本sql语句

     约束

    • primary key 主键 : 物理上存储的顺序
    • not null 非空 : 此字段不允许填写空值
    • unique 唯一 : 此字段的值不允许重复
    • default 外键 :对关系字段进行约束
    • auto_increment : 表示自动增长
    • foreign key : 外键,innodb数据引擎支持外键约束

    命令

    • create table if not exists goods_cates :建表,如果重名报错
    • desc 表名 : 查看表的结构
    • insert into 表名 values();
    • show create table student; 查看创建表属性
    • alter table 表名 add 列名 类型;
    • alter table xxx modify 列名 类型及约束;
    • alter table xxx change 原名 新名 类型及约束;
    • alter table xxx drop 列名;

     增删改查(Create,Delete,Update,Retrieve)

    • insert into xxx values();
    • insert into xxx(name,age) values(); – 部分插入
    • insert into xxx values(1),(2); – 多行插入
    • update xxx set 列1=值1,列2=值2… where 条件; – 修改特定条件下的某属性
    • select * from xxx where 条件; – 条件查询
    • select 字段 as 别名 from xxx where xxx; – 使用as指定别名

  • 相关阅读:
    Linux 基础篇(二)
    Linux 基础篇
    pandas 的使用
    git 使用和一些错误
    NetBackup :Unable to retrieve version of the server xxx.xxx.xxx
    Splunk 基本使用
    Symantec(赛门铁克)非受管检测
    matplotlib 的几种柱状图
    python 清空list的几种方法
    ACE
  • 原文地址:https://www.cnblogs.com/chenxi-mxj/p/11454494.html
Copyright © 2011-2022 走看看