0
1

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コマンドメモ(ormを一旦卒業)

Posted at

orm(gorm:go,SQLAlchemy:python,typeorm:typescript)に頼りすぎたの初歩に戻って勉強!!
MySQLでよく使われる基本コマンドの一覧と、それぞれのコマンドを使用したサンプルコマンドを示します。
ただのメモです笑

コマンド 説明 サンプルコマンド
SHOW DATABASES データベースの一覧を表示 SHOW DATABASES;
CREATE DATABASE データベースを作成 CREATE DATABASE sample_db;
USE データベースを選択 USE sample_db;
SHOW TABLES テーブルの一覧を表示 SHOW TABLES;
CREATE TABLE テーブルを作成 CREATE TABLE users (id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255) NOT NULL, email VARCHAR(255) UNIQUE NOT NULL);
INSERT INTO データを挿入 INSERT INTO users (name, email) VALUES ('Taro Yamada', 'taro@example.com');
SELECT データを検索・取得 SELECT * FROM users;
UPDATE データを更新 UPDATE users SET email='new-email@example.com' WHERE id=1;
DELETE FROM データを削除 DELETE FROM users WHERE id=1;
DROP TABLE テーブルを削除 DROP TABLE users;
DROP DATABASE データベースを削除 DROP DATABASE sample_db;
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?