1
0

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.

mysql操作コマンド

Posted at

いろんな言語や機能を片っ端から弄ってるとすぐにコマンドとか忘れてしまいます‥(°_°)

#データベース関連
データベースの作成
create database hogehoge;
重複予防線
create database if not exists hogehoge;
データベースに接続
use hogehoge;
現在接続中のデータベースを確認
select database();
データベースの削除
drop database hogehoge;

#テーブル関連
テーブルの作成
create table db_hogehoge.tbl_hogehoge (col_name1 data_type1, col_name2 data_type2, col_name3 data_type3..... );
作成されているテーブル確認
show tables (from db_hogehoge);
表示するテーブルを絞り込むことも可能
show tables (from db_hogehoge) like 'fruit';
テーブル情報を取得
show table status

#データ関連
データの追加(useを使ってdbに接続済の場合はdb指定は省略可能)

insert into db_name.tbl_name (col_name1, col_name2, ...)
  values (value1, value2, ...); ```






1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?