当前位置:网站首页>SQL中对 datetime 类型操作
SQL中对 datetime 类型操作
2022-08-03 16:05:00 【威威沁沁】
datetime 是SQL中 表示时间的类型
下面,我将演示几种插入 datetime 类型的数据
先创建一个test 表,定义表中记录为 datetime 类型
create table test(t datetime);
1、插入 now()
now 是 SQL 内置函数,可以获取当前时间
insert into test values(now());
2、插入指定时间
如果我们想插入指定时间的话需要按照格式进行插入,而SQL中时间格式有很多,这次主要介绍标准格式。
标准时间格式:'YYYY-MM-DD HH:mm:ss'
例:'2022-08-01 12:00:00'
边栏推荐
- Fortinet产品导入AWS AMI操作文档
- How to analyze the weekly activity rate?
- Common distributed theories (CAP, BASE) and consensus protocols (Gosssip, Raft)
- [Unity Getting Started Plan] Basic Concepts (8) - Tile Map TileMap 02
- Kubernetes 笔记 / 入门 / 生产环境 / 用部署工具安装 Kubernetes / 用 kubeadm 启动集群 / 安装 kubeadm
- Go Go 简单的很,标准库之 fmt 包的一键入门
- How much do you know about the intelligent operation and maintenance service of data warehouse based on DMS?
- 参与便有奖,《新程序员》杂志福利来袭!
- 视频人脸识别和图片人脸识别的关系
- 基于DMS的数仓智能运维服务,知多少?
猜你喜欢
To participate in sweepstakes, incoming new programmers magazine welfare!
元宇宙系列--Value creation in the metaverse
美国国防部更“青睐”光量子系统研究路线
为教育插上数字化的翅膀,网易云信发布「互联网+教育」整体解决方案
MySQL相关介绍
2021年数据泄露成本报告解读
罗克韦尔AB PLC RSLogix5000中创建新项目、任务、程序和例程的具体方法和步骤
【Unity入门计划】基本概念(6)-精灵渲染器 Sprite Renderer
Not to be ignored!Features and advantages of outdoor LED display
Spark entry learning-2
随机推荐
请问下,flink cdc监控oracle,我看源码是通过sid方式的,请问怎么改成service
如何启动 NFT 集合
使用 PowerShell 将 Windows 转发事件导入 SQL Server
CopyOnWriteArrayList details
MPLS的wpn实验
MATLAB | 一种简易的随机曼陀罗图形生成函数
面了个腾讯35k出来的,他让我见识到什么叫精通MySQL调优
[QT] Qt project demo: data is displayed on the ui interface, double-click the mouse to display specific information in a pop-up window
To participate in sweepstakes, incoming new programmers magazine welfare!
Difference and performance comparison between HAL and LL library of STM32
QT QT 】 【 to have developed a good program for packaging into a dynamic library
托尔斯泰:生活中只有两种不幸
人脸识别损失函数的汇总 | Pytorch版本实现
在 360 度绩效评估中应该问的 20 个问题
vector类
EA 改口,称单人游戏是产品组合中“非常重要的一部分”
下午见!2022京东云数据库新品发布会
移动应用出海,你的“网络优化”拖后腿了吗?
一个文件管理系统的软硬件配置清单
Tolstoy: There are only two misfortunes in life