1
0

More than 3 years have passed since last update.

MySQL:覚えた知識を日々書き留める#1

Last updated at Posted at 2019-10-08

タイトル通り、覚えたことをアウトプットすることで定着と理解を深めようというものです。
メモ書きですが何かの役に立てば幸いです。

1,MySQLをコマンドプロンプトで操作

 ・起動
  mysql -u root -p

 ・データベース作成
  create database データベース名

 ・データベース移動
  use データベース名

 ・テーブル作成
  create table テーブル名(カラム名)

2,エラーが出て解決したのでメモ

 ・テーブル作成時、auto_incrementを設定したカラムは主キーにしなければならない。

 ・テーブル作成時、主キーを複数設定する場合は一番最後にまとめて指定する。

例:

create table sampletable(
      id int,
      name varchar(10),
      age int,
      primary key(id,name));  
1
0
1

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