Thursday, January 16, 2014

When to use SELECT 'x' FROM in a SQL query

The SELECT 'x' FROM tablename WHERE ... is used when you would like to check if data exists in the table with the condition given in the WHERE clause. If a row is found, it returns x, else the ResultSet is empty. It is often used with exists/not exists. For example

SELECT name, id FROM student S WHERE not exists (SELECT 'x' from graduated G WHERE G.id = S.id);

---------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

No comments:

Post a Comment