New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

GAQM CPEH-001 Exam - Topic 1 Question 121 Discussion

Actual exam question for GAQM's CPEH-001 exam
Question #: 121
Topic #: 1
[All CPEH-001 Questions]

Look at the following SQL query.

SELECT * FROM product WHERE PCategory='computers' or 1=1--'

What will it return? Choose the best answer.

Show Suggested Answer Hide Answer
Suggested Answer: C

The 1=1 tells the SQL database to return everything, a simplified statement would be SELECT * FROM product WHERE 1=1 (which will always be true for all columns). Thus, this query will return all computers and everything else. The or 1=1 is a common test to see if a web application is vulnerable to a SQL attack.


Contribute your Thoughts:

0/2000 characters
Sharen
5 days ago
I'm not entirely sure, but I remember something about how "1=1" can be used to bypass filters in SQL.
upvoted 0 times
...
Ty
10 days ago
I think this query will return all products because of the "or 1=1" condition, right?
upvoted 0 times
...
Kimberely
15 days ago
Yep, this is a classic example of a SQL injection vulnerability. I'll be sure to analyze any SQL queries carefully on the exam and look out for potential security issues like this.
upvoted 0 times
...
Denna
20 days ago
Got it, that makes sense. The '1=1' condition is a common technique used in SQL injection attacks to bypass security checks. I'll make sure to watch out for anything like that on the exam.
upvoted 0 times
...
Honey
26 days ago
Wait, what? The '1=1' part makes the whole 'or' condition always true. So it's going to return all rows from the 'product' table, regardless of the 'PCategory' value.
upvoted 0 times
...
Eliseo
1 month ago
Okay, let's see. The query is selecting all rows from the 'product' table where the 'PCategory' is 'computers' or the condition '1=1' is true. The '--' at the end is a comment, so it won't affect the query.
upvoted 0 times
...
Darci
1 month ago
Hmm, this looks like a tricky one. I'll need to think it through carefully.
upvoted 0 times
...

Save Cancel