Results 1 to 6 of 6

Thread: Difference between LIKE and = operator

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Jul 2008
    Answers
    8

    Re: Difference between LIKE and = operator

    Quote Originally Posted by ashalalaxmi2002 View Post
    For query with sql, how do you select all the records from a table named "persons" where the value of the column "firstname" is "peter"? 1 select * from persons where firstname like 'peter' 2 select * from persons where firstname='peter' 3 select [all] from persons where firstname='peter' 4select [all] from persons where firstname like 'peter' whats the correct ans.
    Before u r writing these type of queries, remember one point.

    In case of Like condition u have top mention '%' symbol, For Ex.
    select * from persons where firstname like 'Peters%';
    In case of = condition u have no need to mention any thing but u have to give Exact value for that field, For Ex.
    select * from persons where firstname = 'Peters';

    If the data is with that same name, the data will display.

    I think it's correct answer for ur query.


  2. #2

    Smile Re: Difference between LIKE and = operator

    Both "=" and "like" operator are use to search the data within table. But "=" operator are usede when you are confident about the inputs you have given bcoz query will search that specific value in the table if it will get it will display output otherwise......no output will be there but if you are using like '****%" operator then it will be searching for all the data that are matching your inputs... Enjoy..........

    Thanks
    rajiv gupta
    yogik technologies pvt. Ltd.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact