摘要: 日期相关的函数 seclect 'helloworld'; 1. 获取当前时间 now(); select now(); 2.获取当前的日期 curdate(); select curdate(); 3 获取当前的时间 curtime(); select curtime(); 4. 从年月日时分秒中 阅读全文
posted @ 2022-05-04 23:01 Y_Zoran 阅读(245) 评论(0) 推荐(0)
摘要: 导入*.sql数据到数据库 windows系统 ​ source d:/tables.sql; Linux系统 source /home/soft/桌面/tables.sql; 导入完成后 测试查询 show tables; 查询出两个表 emp和dept select * from emp; 里面 阅读全文
posted @ 2022-05-04 23:00 Y_Zoran 阅读(108) 评论(0) 推荐(0)
摘要: 数据类型 整数类型: int(m) 对应java中的int bigint(m) 对应java中的long m代表显示长度,需要结合 zerofill使用 create table t_int(id int, age int(4) zerofill); insert into t_int values 阅读全文
posted @ 2022-05-04 22:59 Y_Zoran 阅读(31) 评论(0) 推荐(0)
摘要: SQL语言分类 DDL Data Definition Language 数据定义语言 包括: create , alter ,drop , truncate; 不支持事务 DML Data Manipulation Language 数据操作语言 包括: insert delete update 阅读全文
posted @ 2022-05-04 08:21 Y_Zoran 阅读(31) 评论(0) 推荐(0)
摘要: 事务 事务( transaction) 是数据库中执行同一业务多条SQL语句 工作单元,事务可以保证多条SQL语句全部执行成功或全部执行失败 和事务相关的SQL语句: 验证事务: 1. 创建表: create table user (id int primary key auto_increment 阅读全文
posted @ 2022-05-04 08:17 Y_Zoran 阅读(34) 评论(0) 推荐(0)
摘要: 数据冗余--拆分表 如果表设计不合理,可能会出现大量的重复数据,这种现象被称为数据冗余,通过拆分表的形式可以解决此问题 保存集团总部下财务部里面的财务A部的张三工资8000 年龄18 保存集团总部下研发部的李四工资800 年龄75 部门 员工姓名 工资 年龄 create table t_emp(i 阅读全文
posted @ 2022-05-04 08:14 Y_Zoran 阅读(120) 评论(0) 推荐(0)
-->