[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I code a statement in sql with a more than, less than and equal to?

Posted on 2011-05-12
2
Medium Priority
?
388 Views
Last Modified: 2013-12-07
How would I code this:

How many states start with the letter “N”? Are the number of states that start with the
            letter “N” more than, less than or equal to the states that starts with the letter “M”?
0
Comment
Question by:KayMJay
  • 2
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 35747291
select count(case when state_name like 'N%' then 1 end) Ncount,
count(case when state_name like 'M%' then 1 end) Mcount
from states
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35747312
you can either return the results "as is", or if you want to include the more/less/equal evaluation in the results then put another case that checks the results of the counts and displays whatever message you want
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question