To insert records into mysql tables use the insert into sql statement.The below insert statement add new records into the table pytable. Please refer to my previous post for table creation and table structure - sql-creating-tables-in-mysql
insert into pytable values(1,'Snikers','CH',NOW(),100.00); insert into pytable values(2,'Galaxy','CO','2015-01-01',200.00); insert into pytable values(3,'Butterfinger','CN',NOW(),150.00);
If the record addition is valid it will return the message
mysql> insert into pytable values(1,'Snikers','CH',NOW(),100.00); Query OK, 1 row affected, 1 warning (0.04 sec) mysql> insert into pytable values(2,'Galaxy','CO','2015-01-01',200.00); Query OK, 1 row affected (0.03 sec) mysql> insert into pytable values(3,'Butterfinger','CN',NOW(),150.00); Query OK, 1 row affected, 1 warning (0.04 sec)
To view the records inserted use the select statement
mysql> select * from pytable; +------+--------------+--------+------------+--------+ | pyid | pyname | pycode | pydate | pynum | +------+--------------+--------+------------+--------+ | 1 | Snikers | CH | 2016-08-05 | 100.00 | | 2 | Galaxy | CO | 2015-01-01 | 200.00 | | 3 | Butterfinger | CN | 2016-08-05 | 150.00 | +------+--------------+--------+------------+--------+ 3 rows in set (0.00 sec)
Comments
Post a Comment