zoukankan      html  css  js  c++  java
  • mysql常见命令?

    查看多少库存在?

    show databases;

    建库:
    create database yintao;
     
    查看 
    show databases;
     
    使用库
    use yintao;
     
    建表
    create table students(
        id int unsigned not null auto_increment primary key,
        name char(8) not null,
        sex char(4) not null,
        age tinyint unsigned not null,
        tel char(13) null default "-"
    );
     
    查看
    show tables;
    desc students;
     
    增 insert
    insert [into] 表名 [(列名1, 列名2, 列名3, ...)] values (值1, 值2, 值3, ...);
    insert into students values(NULL, "王刚", "男", 20, "13811371377");
    insert into students (name, sex, age) values("孙丽华", "女", 21);
     
    删 delete
    delete from 表名称 where 删除条件;
    delete from students;
    delete from students where id=2;
    delete from students where age<20;
     
    改 update
    update 表名称 set 列名称=新值 where 更新条件;
    update students set tel=default where id=5;
    update students set age=age+1;
    update students set name="张伟鹏", age=19 where tel="13288097888";
     
    查 select
    select 列名称 from 表名称 [查询条件];
    select name, age from students;
    select * from students;
     
    select * from students where age > 21;
    select * from students where name like "%王%";
    select * from students where id<5 and age>20;
  • 相关阅读:
    Java日期与时间的处理/Date,String,Calendar转换
    swift中的&---文章过时重置
    函数
    分支语句?
    NSDateFormatter 'YYYY' 和 'yyyy' 的区别
    swift字典集合---文章过时重置
    Swift字符串的插入、删除和替换-备
    PHP 时间函数集合
    PHP 正则通配符
    PHP的数据库 之 关闭问题
  • 原文地址:https://www.cnblogs.com/sunyang-001/p/10827517.html
Copyright © 2011-2022 走看看