I have seen many queries with something as follows.
Select 1
From table
What does this 1
mean, how will it be executed and,
If you don't know there exist any data in your table or not, you can use following query:
SELECT cons_value FROM table_name;
For an Example:
SELECT 1 FROM employee;
So, we use this SQL query to know if there is any data in the table & the number of rows indicates how many rows exist in this table.
it does what it says - it will always return the integer 1. It's used to check whether a record matching your where clause exists.
To be slightly more specific, you would use this to do
SELECT 1 FROM MyUserTable WHERE user_id = 33487
instead of doing
SELECT * FROM MyUserTable WHERE user_id = 33487
because you don't care about looking at the results. Asking for the number 1 is very easy for the database (since it doesn't have to do any look-ups).