2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SQL メモ書き

Last updated at Posted at 2015-04-02

概要

 SQL(Oracle)のメモ書きです。
 少しずつ更新していきます。

最新の10件取得
select * 
from (select * from tablename order by lastupdatetime desc)
where rownum <=10
シーケンスの値を、yyyyMMddに変換する
select TO_DATE('00000','HH24MISS') + (10 / 86400) from dual
対象カラムに同じ値が2件以上あるものを探す
select count(*) from tablename group by columnname having count(*) > 1
対象カラムへの文字列置き換え
UPDATE `dbname`.`tblname` SET 対象カラム名=REPLACE(対象カラム名, "置換え前", "置換え後")
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?