SQLテーブルを作成

戻る

limbs.sql ------------------------------------------------------------------------ DROP TABLE IF EXISTS limbs; CREATE TABLE limbs ( things VARCHAR(20), legs INT, arms INT ); INSERT INTO limbs (things,legs,arms) VALUES('human',2,2); INSERT INTO limbs (things,legs,arms) VALUES('insect',6,0); INSERT INTO limbs (things,legs,arms) VALUES('squid',0,10); INSERT INTO limbs (things,legs,arms) VALUES('octopus',0,8); INSERT INTO limbs (things,legs,arms) VALUES('fish',0,0); INSERT INTO limbs (things,legs,arms) VALUES('centipede',100,0); INSERT INTO limbs (things,legs,arms) VALUES('+eg Leg Pete',1,2); ------------------------------------------------------------------------ 方法1 C:\database\sql>mysql cookbook < limbs.sql -u cbuser -p Enter password: ****** 方法2 C:\database\sql>mysql -u cbuser -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. mysql> use cookbook; Database changed mysql> source limbs.sql Query OK, 0 rows affected (0.08 sec) ........
戻る