Iteration A1 (Create the Products Table)

Products テーブルの作成

~/depot$ cat >db/create.sql
drop table if exists products ;
create table products (
id int not null auto_increment,
title varchar(100) not null,
description text not null,
image_url varchar(200) not null,
price decimal(10, 2) not null,
primary key (id)
) ;
~/depot$
~/depot$ ls db
create.sql
~/depot$ mysql depot_development -u root -p <db/create.sql
Enter password: 
~/depot$ mysql depot_development -u root -p
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 28 to server version: 4.0.24_Debian-10-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> desc products ;
+-------------+---------------+------+-----+---------+----------------+
| Field       | Type          | Null | Key | Default | Extra          |
+-------------+---------------+------+-----+---------+----------------+
| id          | int(11)       |      | PRI | NULL    | auto_increment |
| title       | varchar(100)  |      |     |         |                |
| description | text          |      |     |         |                |
| image_url   | varchar(200)  |      |     |         |                |
| price       | decimal(10,2) |      |     | 0.00    |                |
+-------------+---------------+------+-----+---------+----------------+
5 rows in set (0.02 sec)

mysql> exit
~/depot$