MySQLMemo
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[SAGA]]
#contents
* 科研費申請と実績報告書用データ(2024/08/26) [#o48a202e]
- 報告書用データベース
kakenhi_R2
kakenhi_R4
* 二つのテーブルを比較して差分を表示(2018/09/20) [#m2f4df...
- データの更新前後のテーブルを比較する場合に便利。
select * from saga_uptest.abundance b where not exists (...
- カタログの更新チェック
select * from saga_LG_uptest.object_catalog b where not ...
* MySQLでテーブルの数をカウント(2017/11/21) [#e8269f2c]
- 一時テーブルのカウントに利用。
select count(*) from `information_schema`.`tables` where...
- おまけ:テーブルのレコード数をカウント。
select table_name, table_rows from information_schema.TA...
where table_schema = 'suda_tmp';
* テーブル名変更 [#rf9d79a1]
- alter table ... renameを使う
ALTER TABLE tbl_name RENAME [TO] new_tbl_name;
* データベースのコピー [#j3fb4459]
- mysqldumpを使う。
mysqldump -u username -p db_name > db_name.sql
mysql -u username -p db_name2 < db_name.sql
-- db_name2は.sql内部で指定しているので不要(2026/01/16)
* MySQLテーブルが作成された日時を取得。(2016/07/08) [#ffa...
select table_schema, table_name, create_time from inform...
- 使用例: 最新データの登録日時
select table_schema, table_name, create_time from infor...
* MySQLテーブルが更新された日時を取得。(2024/05/06) [#z6a...
select table_schema, table_name, update_time from inform...
- table_schema = saga_LG_uptest, table_name = object_catl...
終了行:
[[SAGA]]
#contents
* 科研費申請と実績報告書用データ(2024/08/26) [#o48a202e]
- 報告書用データベース
kakenhi_R2
kakenhi_R4
* 二つのテーブルを比較して差分を表示(2018/09/20) [#m2f4df...
- データの更新前後のテーブルを比較する場合に便利。
select * from saga_uptest.abundance b where not exists (...
- カタログの更新チェック
select * from saga_LG_uptest.object_catalog b where not ...
* MySQLでテーブルの数をカウント(2017/11/21) [#e8269f2c]
- 一時テーブルのカウントに利用。
select count(*) from `information_schema`.`tables` where...
- おまけ:テーブルのレコード数をカウント。
select table_name, table_rows from information_schema.TA...
where table_schema = 'suda_tmp';
* テーブル名変更 [#rf9d79a1]
- alter table ... renameを使う
ALTER TABLE tbl_name RENAME [TO] new_tbl_name;
* データベースのコピー [#j3fb4459]
- mysqldumpを使う。
mysqldump -u username -p db_name > db_name.sql
mysql -u username -p db_name2 < db_name.sql
-- db_name2は.sql内部で指定しているので不要(2026/01/16)
* MySQLテーブルが作成された日時を取得。(2016/07/08) [#ffa...
select table_schema, table_name, create_time from inform...
- 使用例: 最新データの登録日時
select table_schema, table_name, create_time from infor...
* MySQLテーブルが更新された日時を取得。(2024/05/06) [#z6a...
select table_schema, table_name, update_time from inform...
- table_schema = saga_LG_uptest, table_name = object_catl...
ページ名: