動作確認環境
- Windows 10 Pro(64bit)
- 8.0.36 MySQL Community Server - GPL
随時、追加予定
データベースを作成
基本文
create database <database_name>;
具体例
create database mydb;
使用するデータベースを切り替える
基本文
use <database_name>;
具体例
use mydb;
作成したデータベース一覧を表示する
show databases;
データベースのバージョンを知る
select version();
作成したテーブル一覧を表示する
show tables;
作成したテーブルの各カラムのデータ型を知りたい(簡易版)
基本文
show columns from <table_name>;
具体例
show columns from mytable;
作成したテーブルの各カラムのデータ型を知りたい
- 上記に加えて、Collation, Privilages, Commentの列が追加されています。
基本文
show full columns from <table_name>;
具体例
show full columns from mytable;
現在日時、時刻を表示する
select now();
UNIXタイムスタンプを表示する
select unix_timestamp();