ニュース

初級エンジニア向けのSQLチートシートです。SQLで迷った時にご活用ください! -- テーブルの作成 CREATE TABLE テーブル名 ( 列名1 データ型 制約, 列名2 データ型 制約, ...); -- テーブル構造の確認 DESCRIBE テーブル名; -- MySQL SHOW ...
mysql> SET foreign_key_checks=OFF; テーブル名の変更 mysql> ALTER TABLE t0_old RENAME TO t0_new; テーブルの名前変更操作はInstantで実行可能です。 テーブルのコピーを作成せずに、テーブルに対応するファイルの名前を変更します。
以下はproductsテーブルに新しいレコードを追加時、procutsテーブルの既存のレコードを更新時毎回以下のSQLが走り条件を満たしていない場合はエラーが発生するようになります。
MySQL compatibility The RENAME TABLE statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.
The old_table_name must exist n the database and the new_table_name must not. For example, we have a table name demo and we want to change its name as demo1. So we will execute the following MySQL ...