SELECT * FROM table WHERE time_to_sec(time)<time_to_sec('15:00:00')
以上为比较方法。
在Oracle系统中,select语句的基本语法格式如下:
select [distinct] [*, column_name [alias], …] from tablename Where {conditions} group by {conditions} having order by expressions} [ASC/DESC]
查询所有列:
select * from table
查询指定列:select colum1,colum2 from table
取消重复行:select distinct deptno,job from emp
使用表达式:可以在查询列中使用表达式来连接字符串(使用 || 连接字符串)、改变显示格式(如使用函数to_char)、计算显示的数据(如使用+,-,×,/)等。
举例:
select * from emp
select ename ,sal,deptno from emp
select deptno from emp
select distinct deptno from emp
首先,mysql中是没有select current_time这么一说的(select是用来查询有结果返回的表达式),select要么调用函数如select current_time(),或者说从数据表查询数据 select current_time from table。其次,要注意mysql中对应的时间日期格式类型,也就是UPDATE_DATE的字段类型,具体如下:
① 时间日期类型datetime/mysql时间戳timestamp(Ymdhis:20181212121212,对应显示2018-12-12 12:12:12),那么结果应该是:UPDATE T_SYUTYOU SET UPDATE_DATE = now(),因为now()保存的结果是一个datetime类型
② 时间型time(his:121212,对应显示12:12:12),那么结果应该是:UPDATE T_SYUTYOU SET UPDATE_DATE = curtime()/current_time(),因为curtime()和current_time()一样保存的结果是一个time类型
③ 真正时间戳int unsigned(格林位置时间到目前位置的秒数:1545891091),那么结果应该是:UPDATE T_SYUTYOU SET UPDATE_DATE = unix_timestamp(),因为unix_timestamp()保存的结果是一个真正意义的时间戳
想要了解更多的一些关于MySQL的 *** 作,可以去看看黑马程序员的6天玩转MySQL
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)