mysql
// =============== お知らせ案内 取得 ============ $sql = <<< SQL SELECT annai_title, start_date, annai_test FROM informs WHERE start_date <= CURDATE() AND end_date >= CURDATE() order by sentence_number desc SQL; $go_index_oshirase = DB::se…
・レコードの総件数を調べる count(*) select count(*) from tossy; +----------+| count(*) |+----------+| 6 |+----------+ ・フィールドにどんな値が入っているか調べる distinct select distinct team from tossy; +--------+| team |+--------+| red ||…
・並び替え(小さい順) order by select * from tossy order by score; +----+--------+------------------+--------+-------+---------------------+| id | name | email | team | score | created |+----+--------+------------------+--------+-------+-…
・and 指定した、条件が全て揃ったもの select * from tossy where score >= 4.0 and team = 'yellow'; +----+------+-------------+--------+-------+---------------------+| id | name | email | team | score | created |+----+------+-------------+---…
・範囲に合致するもの between select * from tossy where score between 5.0 and 10.0; +----+------+----------------+--------+-------+---------------------+| id | name | email | team | score | created |+----+------+----------------+--------+--…
select * from tossy where email like '%gmail.com'; +----+--------+------------------+--------+-------+---------------------+| id | name | email | team | score | created |+----+--------+------------------+--------+-------+------------------…
・レコードを選んで抽出select name, created from tossy; +--------+---------------------+| name | created |+--------+---------------------+| toko | 2016-01-05 19:00:00 || to | 2016-01-01 15:00:00 || hanako | 2016-01-02 16:00:00 || hana | 201…
mysql テーブル(その中のシート)フィールド(列)レコード(行) ----- ・起動mysql -u root ----- ・パスワード設定set password for root@localhost=password('パスワード'); ・パスワード入力mysql -u root -p パスワードを入力する -----・(仮)データ…