zoukankan      html  css  js  c++  java
  • Android学习-mysql 数据库基础语句

    今天是2016年8月02日

    mysql 数据库的增删改查操作

    部门表1-1


    职务表 1-2

         

    用户表 1-3

     

    创建表:

    部门表

    CREATE TABLE `dept` (

      `id` int(11) NOT NULL AUTO_INCREMENT,

      `num` int(11) DEFAULT NULL,

      `name` varchar(20) DEFAULT NULL,

      `address` varchar(20) DEFAULT NULL,

      PRIMARY KEY (`id`)

    )

    职务表:

    CREATE TABLE `duty` (

      `id` int(4) NOT NULL AUTO_INCREMENT,

      `num` int(4) NOT NULL,

      `name` varchar(20) DEFAULT NULL,

      `low` varchar(10) DEFAULT NULL,

      `high` varchar(10) DEFAULT NULL,

      PRIMARY KEY (`id`)

    )

    用户表:

    CREATE TABLE `login` (

      `id` decimal(4,0) NOT NULL DEFAULT '0',

      `userName` varchar(20) DEFAULT NULL,

      `password` varchar(20) DEFAULT NULL,

      PRIMARY KEY (`id`)

    )

    删除表:

    Drop  table  + 表名

    Drop table duty

    Drop table dept

    Drop table login

    向表中插入数据

    Insert into duty(num,name,low,high) values(‘数据1’,‘数据1’,‘数据1’,‘数据1’);

    更新表数据

    Update duty set name =’更改的名称’ where num =1;

    更新多个字段

    Update duty set name =’更改的名称’ , low=4500 where num =1;

    删除表数据

    Delete  from duty where num=1;

    查询数量

    Select count(num) from duty


  • 相关阅读:
    WPF:ListView 分组合并
    WPF:ListView 分页
    SQL
    多线程27 -- ReentrantLock
    String 对象常用方法及属性 详细介绍
    js中Array 对象方法 详细介绍
    js--运算符与或非 及 if判断条件、隐式转换 介绍
    js-函数表达式和函数声明的区别
    js预编译案例分析
    js--万物皆对象
  • 原文地址:https://www.cnblogs.com/WK-can-do-anything/p/5792225.html
Copyright © 2011-2022 走看看