Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Modifying Data with SQL Deleting Data From a Database Deleting Data With SQL

pinky
pinky
617 Points

what is a condition again?

Im not sure what condition Im to put to delete spefic rows.

3 Answers

Hi. A condition is a statement that has to be accomplished before executing something.

For example, let's say I have a table called Person, and I want to delete all the people younger than 20 years old. I would write "DELETE * FROM Person WHERE age < 20;". "WHERE age < 20" would be the condition.

pinky
pinky
617 Points

I need to delete all products priced at 11 or higher. But I'm stuck because the code I'm using isn't working. The code I'm using is DELETE * FROM products WHERE price < 11;

Because you are deleting all the products with prices lower than 11

pinky
pinky
617 Points

Yah I reliazed that after I posted that. Thank yoi so much for helping me figure it out.