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

    -- 创建数据库

    create  database  数据库名    default  charset =utf8;

    -- 创建表

    create table  表名  ( id    int,name  char(20));

    create table  表名  (id int   null/not null,name  char(20) )  engine=innodb  default charset=utf8;

    create  table 表名     (id int null,    name char(20) not null,    age int not null    auto_increment primary key)  engine=innodb default charset=utf8;

    create  table  表名  (num  decimal(10,5))          decimal类型指小数点前允许有十位数,小数点后允许有五位数,decimal,float,double都属于小数类型

    -- 清空表

    delete  from  表名;                             自增id会继续往后走

    truncate  table  表名;                         自增id将从1开始

    delete  from table  where  id <6;

    --删除表

    drop table 表名;

    -- 修改表

    updata  表名  set  age =18;

    update 表名   set  age=18  where  age=17;

    -- 向表内插入数据

    insert  into  表名(id,name) values(1,'alex');

    -- 查看数据库

    show databases;

  • 相关阅读:
    python sys 模块
    python os 模块
    JS Dictionary
    JS Array
    JS String
    JS面向对象
    WPF中INotifyPropertyChanged用法与数据绑定
    JS的函数
    JS类型转换
    JS变量的作用域
  • 原文地址:https://www.cnblogs.com/luckiness/p/13080279.html
Copyright © 2011-2022 走看看