zoukankan      html  css  js  c++  java
  • MYSQL关键字的使用

    /*

    create/select/insert/update/where

    */

    create//创建数据库、表、存储过程、视图等
    select//读取一条或者多条记录

    /*创建数据库*/
    create database test;


    /*创建users表*/
    create table if not exists users(
    id int not null auto_increment,
    name varchar(50) not null,
    gender varchar(2) not null,
    birthday date not null,
    address varchar(100) not null,
    telephone varchar(11) not null,
    primary key(id)
    )engine=innodb default charset=utf8;
    //engine表示用innodb引擎,默认字符为utf8


    /*创建ck存储过程*/
    delimiter $
    create procedure if not exists ck()
    begin
    select * from users;
    end $
    delimiter ;

    insert//insert into插入数据

    insert into users(id,name,gender,birthday,address,telephone) values (1,"高某","男","1981-11-05","北京","15809320031");
    insert into users(name,gender,birthday,address,telephone) values ("罗某","女","1984-01-15","北京","15800310933");
    insert into users(name,gender,birthday,address,telephone) values ("张某","女","1994-05-01","北京","15899432158");
    insert into users(name,gender,birthday,address,telephone) values ("曹某","女","1995-08-19","北京","17803318972");
    insert into users values(5,'唐某','1994-10-01','甘肃','13756024455');

    update//更新一个或多个字段

    update users set address="甘肃",telephone="17103318972" where id=4;

    alter//添加、删除或修改字段

    alter table users modify name varchar(25);

    like//LIKE 子句与等号 = 的效果是一样的,SQL LIKE 子句中使用百分号 %字符来表示任意字符。

    select * from users where telephone like "158%";

  • 相关阅读:
    JetBrains Rider 在 Mac 环境下将 cs 文件生成 exe
    Unity3d 控制物体移动、旋转、缩放
    Unity3d 脚本使用规则
    Unity3D 脚本模板修改方法
    Intelli IDEA 设置项目编码(Mac)
    搭建LayaBox的生产环境,并helloWorld
    unity Lighting
    流畅度测试
    Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
    Unity GUI(uGUI)使用心得与性能总结
  • 原文地址:https://www.cnblogs.com/Mr-Wenyan/p/8874989.html
Copyright © 2011-2022 走看看