oracle sql 时间间隔计算
计算间隔时间:
select f_date,f_cstime,f_cetime, (((SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS')) * 86400000)-((SYSDATE- TO_DATE(f_date||f_cetime,'YYYYMMDDHH24MISS')) * 86400000))/1000 CURRENT_MILLI from ycsq_t_hauthlog where f_cstime<>'999999'
将字符串转换成日期类:SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS'),
SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS')*86400000 转换成毫秒
相关文档:
Student(S#,Sname,Sage,Ssex) 学生表
Course(C#,Cname,T#) 课程表
SC(S#,C#,score) 成绩表
Teacher(T#,Tname) 教师表
问题:
1、查询“”课程比“”课程成绩高的所有学生的学号;
SELECT a.S# from (SELECT s#,score from SC WHERE C#='001') a,
(SELECT s#,score fr ......
select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) order by id desc
select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) ......
----start
在SQL语句中应该尽量避免使用OR,因为这样做会影响SQL语句的性能。考虑下面的情况:
CREATE TABLE USER
(
NAME VARCHAR(20) NOT NULL,---姓名
BIRTHDAY DATE---生日
);
现在有这样一个问题:让你查找一下生日是1949-10-1(共和国同龄人)或1978-12-18(十一届三中全会召开时间) ......
transaction 1:
------------------------------------------------------
begin transaction
update table1 set cola = 'str1'
Waitfor time '10:12:00'
update table2 set colb = 'str2'
rollback transaction
transaction 2:
---- ......