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


  • 相关阅读:
    报错:java.lang.IllegalStateException
    Eclipse中修改SVN用户名和密码方法
    部署服务器项目报错
    mybatis的双数据源创建
    SVN改地址eclipse怎么同步
    java中文乱码问题解决
    python3 内置函数
    python 生成器generator
    python 理解高阶函数
    python3 装饰器
  • 原文地址:https://www.cnblogs.com/WK-can-do-anything/p/5792225.html
Copyright © 2011-2022 走看看