0
2

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.

データベースやSQLって何?【初学者用】

0
Posted at

プログラマーが必ずといって理解しておくべき「データベース」の基本についてまとめてみました。

データベースとは

__データを保存して管理する場所__です。複数のデータを管理し、検索し、編集ができます。

クライアント(検索してきた人、PC)がWebサーバーにリクエストしたら、Webサーバー内にあるApacheとPHPなどが処理してデータベースに接続し、必要なデータを取り出したり編集したりしてくれます。

RDB(リレーショナルデータベース)とは

主に三つあります。

  • MySQL(無料。主に使われている)
  • PostgreSQL
  • Oracle

DBの中身

  • テーブル(エクセルでいうシート)
  • カラム(エクセルでいう列)
  • レコード(エクセルでいう行)

SQLとは

データベースを操作する言語。

DBを操作するための言語(コマンド)あり。

データベースを操作してみよう

Macの場合ターミナルなどで操作します。

MySQLにログイン
	mysql -u [ユーザー名] -p

どのデータベースを使うか選択(use)
	USE [データベース名];

選択したデータベースが持つテーブルを表示(show)
	SHOW DATABASES;

テーブルの中身を見る
	SHOW TABLES;

SQLの基本コマンド

  • 検索 「select」
  • 追加 「insert」
  • 更新 「update」
  • 削除 「delete」

他にもありますが、どんどん使って慣れましょう!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?