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

Posted on 2011-05-12
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”?
Question by:KayMJay
    LVL 73

    Accepted Solution

    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
    LVL 73

    Expert Comment

    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

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
    Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
    This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
    This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now