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?

SELECT文|データベースからデータ抽出する方法

1
Posted at

はじめに

今回は、SQLの基本となるSELECT文について解説していきます。

SELECT文とは

SELECT文とは、データベースから必要なデータを取得するためのSQL文のこと

基本形は以下です。

SELECT カラム名
FROM テーブル名;

意味としては、とてもシンプルです。

  • SELECT:何のデータを取得するか
  • FROM:どのテーブルから取得するか

例えば、usersテーブルからnameを取得したい場合は以下のように書きます。

SELECT name
FROM users;

すべてのカラムを取得する

すべてのカラムを取得したい場合は、*を使います。

SELECT *
FROM users;

*は「すべてのカラム」という意味です。

終わりに

SELECT文は、

どのテーブルから、何のデータを取得するか

を指定するSQLの基本的な構文です。

一気に覚えようとせず、小さく細かくまとめながら、分かることを少しずつ増やしていきます。

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?