当前位置: 首页 > news >正文

MySQL 8 update语句更新数据表里边的数据

数据重新补充

这里使用alter table Bookbought.bookuser add userage INT after userphone;为用户表bookuseruserphone列后边添加一个类型为INT的新列userage
使用alter table Bookbought.bookuser add sex varchar(6) after userage ;为用户表bookuseruserage 列后边添加一个类型为INT的新列sex
在这里插入图片描述

describe Bookbought.bookuser;查看数据库中的表结构,可以查看插入之后的数据字段。
在这里插入图片描述

update更新数据

使用格式如下:

update 数据库.表名 
set 字段 = 字段值  
where 判断条件

使用下方的update语句把以前没有填上去的年龄填上去。

update Bookbought.bookuser set userage = 31,sex='male' where id = 1;
update Bookbought.bookuser set userage = 32,sex='female' where id = 2;
update Bookbought.bookuser set userage = 33,sex='male' where id = 3;
update Bookbought.bookuser set userage = 34,sex='female' where id = 4;
update Bookbought.bookuser set userage = 35,sex='male' where id = 5;
update Bookbought.bookuser set userage = 36,sex='male' where id = 6;
update Bookbought.bookuser set userage = 37,sex='female' where id = 7;
update Bookbought.bookuser set userage = 38,sex='male' where id = 8;
update Bookbought.bookuser set userage = 45,sex='male' where id = 9;
update Bookbought.bookuser set userage = 50,sex='female' where id = 10;

在这里插入图片描述

http://www.lryc.cn/news/258955.html

相关文章:

  • 可视化监控云平台/智能监控平台EasyCVR国标设备开启音频没有声音是什么原因?
  • L1-039:古风排版
  • 树莓派新手装机指南
  • flink使用事件时间时警惕kafka不同分区的事件时间倾斜问题
  • 『App自动化测试之Appium基础篇』| Desired Capabilities详解与使用
  • vscode插件webview和插件通信
  • 【STM32单片机】贪吃蛇游戏设计
  • 【Java 基础】32 定时调度
  • C++ 教程 - 02 复合数据类型
  • 【数据处理】NumPy数组的合并操作,如何将numpy数组进行合并?
  • JavaScript实现飘窗功能
  • Docker笔记:容器转换成镜像,导出导入镜像,数据拷贝,查看日志
  • 串行计时芯片D1380/D1381,2.0V~5.5V 工作电流: 2V时 与TTL 兼容,采用DIP8、SOP8封装
  • 中间件系列 - Redis入门到实战(基础篇)
  • 项目经理和产品经理该如何选择?
  • java WebSocket带参数处理使用
  • OkHttp: 拦截器和事件监听器
  • 总结一些vue3小知识2
  • 【Excel设置动态图表】
  • 用 C 写一个卷积神经网络
  • 直面双碳目标,优维科技携手奥意建筑打造绿色低碳建筑数智云平台
  • docker 基础入门
  • HarmonyOS:NativeWindow 开发指导
  • 汉威科技传感器为农业加点“智慧”
  • springboot listener、filter登录实战
  • 【数据结构—栈的实现(数组栈)】
  • Linux安装Halo(个人网站)
  • Java - Spring中Bean的循环依赖问题
  • 使用 Python 实现简单的爬虫框架
  • Activiti七大接口,28张表详解