Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMaria De Bruyn
4,635 PointsHow to insert data into database using mySQL
Can anyone tell me what I am doing wrong? Am I making the answer too complicated?
JoJo KoKo
4,712 PointsDepends on how much data you want to add in. If you want to add a single row to a table in MySQL, you can use the insert syntax.
e.g. insert into TABLE_NAME (COLUMN_NAME_1, COLUMN_NAME_2) values (VALUE_FOR_COLUMN_1, VALUE_FOR_COLUMN_2);
3 Answers
Iain Diamond
29,379 PointsAssuming you have the table schema defined correctly for title (e.g. varchar(60)) and year (e.g. int(4)) your SQL statement looks perfectly okay.
iain
Maria De Bruyn
4,635 PointsINSERT INTO movies (title, year) VALUES ("Back to the Future", 1985);
Maria De Bruyn
4,635 PointsIt looks like the problem was with treehouse. Thanks for your help!
Iain Diamond
29,379 PointsIain Diamond
29,379 PointsHi Maria,
Could you post your working, please?
iain