oracle不支援select top語句,在oracle中經常是用order by跟rownum
select 列名1 ...列名n from
(select 列名1 ...列名n
from 表名 order by 列名1
)where rownum <=n(抽出記錄數)
order by rownum asc
如:按姓名排序取出前十條資料
select id,name from (select id,name from student order by name) where rownum<=10 order by rownum asc
查詢車輛表前100萬條資料(按照id排序,主鍵id是number型別):
select id,
caseid,
partyid,
vehicleno,
tagcolor,
tcertificationcode,
rtcissuer,
routineno,
vehiclebrand,
vehicletypeid,
ownerunit,
ownerunittypeid,
drivingstateid,
insurancecompanyid,
updatetime,
updateaccountid,
tagexceptiontypeid,
vehicleindentifyid,
registertime,
insuranceno,
weight,
basiccodeid
from (select id,
caseid,
partyid,
vehicleno,
tagcolor,
tcertificationcode,
rtcissuer,
routineno,
vehiclebrand,
vehicletypeid,
ownerunit,
ownerunittypeid,
drivingstateid,
insurancecompanyid,
updatetime,
updateaccountid,
tagexceptiontypeid,
vehicleindentifyid,
registertime,
insuranceno,
weight,
basiccodeid
from tc_vehicle
order by id)
where rownum <= 1000000
order by id asc
批量插入100萬條資料
建立資料庫 create database create database bulktestdb gouse bulktestdb go create table create table bulktesttable id int primary key,username nvarchar 32 p...
PHP爬蟲 100萬條資料其實不難
php爬取100萬條資料,首先要思考這三個問題 怎麼爬取?怎麼提公升爬取速度?怎麼存放爬取的資料?第乙個想到是不是分布式爬蟲呢,主機多的話是可以這麼張狂任性的,單機的話就要內斂些了。不能分布式,那可以多執行緒啊,換個方向也是很有逼格的。php多執行緒,我首選 swoole 了,不僅可以 多執行緒,還...
SQL 快速向表中插入100萬條資料
setnocounton 02use master 03go 04 判斷資料庫testdb是否存在,即建立資料庫 05if db id testdb isnull 06createdatabasetestdb 07go 08use testdb 09go 10 判斷nums 表是否存在,存在即將其刪...