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 1 year has passed since last update.

MySQLのSQL文メモ

Last updated at Posted at 2024-03-11

動作確認環境

  • 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();
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?