随机选择行的SQL语句? ORACLE SQLSERVER ECT.
MySQL:
SELECT column from table
ORDER BY RAND()
LIMIT 1
PostgreSQL:
SELECT column from table
ORDER BY RANDOM()
LIMIT 1
Microsoft SQL Server:
SELECT TOP 1 column from table
ORDER BY NEWID()
IBM DB2
SELECT column, RAND() as IDX
from table
ORDER BY IDX FETCH FIRST 1 ROWS ONLY
Thanks Tim
Oracle:
SELECT column from
( SELECT column from table
ORDER BY dbms_random.value )
WHERE rownum = 1
Thanks Mark Murphy
Feel free to post other example, variations, and SQL statements for other database servers in the comments.
相关文档:
一、 常用日期数据格式
1.Y或YY或YYY 年的最后一位,两位或三位
SQL> Select to_char(sysdate,'Y') from dual;
TO_CHAR(SYSDATE,'Y')
--------------------
7
SQL> Select to_char(sysdate,'YY') from dual;
TO_CHAR(SYSDATE,'YY')
---------------------
07
SQL> Select to_char(sysdate,'YYY') from d ......
Can you connect to an Oracle database with a 64-bit Oracle client?
Technote (FAQ)
Question
You are unable to connect to an Oracle database with a 64-bit Oracle client. Does Lotus Enterprise Integrator (LEI), Lotus Domino Enterprise Connection Services (DECS), or LSX ......
方法一:最简单的方法(需建库)
备份:
直接拷贝oracle目录下的admin、oradata两个文件夹,ora92目录下database,到其他存储实现备份。
恢复:
1.创建一个和原来一样的数据库。(安装路径和数据库名必须和原来一致)
2.用管理员连入数据库后停止数据库。
3.把安装目录下的admin和oradata复制过去覆盖(如果存在 ......
Oracle
1,shutdown之后,如何启动数据库实例?
通过CMD命令符 sqlplus "sys/password as
sysdba",会连到一个空闲实例,这样可再用startup命令。
2,装了数据库之后,用了shutdown,后用了startup等启动之后,可用sql
plus和网页方式连oracle。但用jdbc连接出错?
是监听器没启动:D:\oracle\product\10.1.0\Db_1\ ......
Cross Apply使表可以和表值函数结果进行join, 这样表值函数的参数就可以使用一个结果集,而不是一个标量值,下面是book online的原文,有例子,有解释。
The APPLY operator allows you to invoke a table-valued function for each row returned by an outer table expression of a query. The table-valued function act ......