what about this one

  • the question is write a query that will retun The number of different fruits in tblFruit

    tblfruit only has 2 field fruit id and fruitdescription

    can someone tell me whether i got the question wright and the statment which i have written is a valid statment in sql server environment.

     

    Select count(DISTINCT(FruitDescription)) from tblFruit;

    if not any alternative way of writing it ?

     

  • Select count(*) FROM dbo.TblFruit should do it.

     

    However this assumes that no duplicates are in the table.

  • Select count(*) FROM dbo.TblFruit should do it,

     

    what does dbo stands for ?

    no info has been given about duplicates, and best answer is needed, is my query is valid and works fine in sql server ?

  • dbo. is the owner of the object.

    If no restriction has been created on the name field, then you have to use count(distinct ...)).

     

    I would suggest you add one so that your data keeps making sens!

  • You all are being 'suckered'. This poster is applying for a job that they aren't qualified for and they don't want to do the work themselves.

    FYI - this poster had this to say in another thread:

    im oracle dba and applied for sql dba job and been given sql db questions, to answer and post it back havent got time to go through books and stuff, just quick, simple answer will do.

    never used sql db lol

    -SQLBill

  • i havent got sql server installed !!!and at this time im in hurry,!!!  its just the matter of syntax !!!!in access/oracle u may use distinct where in sql server u may use unique keyword ( just an example ), this is all what i want to double check mr SQL bill , the questions are sql server specific thats all, even in reall life someone who is good at sql can easy get away with sql syntax,

    why are u soo annoyed by my questions???

    do u really think a company will hire a dba who struggles? with writing select statment ?

    i never wish to be working for such a company !!!

    u got it now? by the way im one of the youngest oracle qualified dba !!!

    once u are professional dba it doesnt really matters whether u know about sql,sybase or oracle .... once u know the game u are done, ....

    does it feel any better now ?

    just havent got time and u are waisting it 

    bye

  • My problem is that the Books OnLine is downloadable. You are applying for a SQL Server DBA job and have posted LOTS of questions here. They are very basic SQL Server questions. You've shown us you aren't qualified for the job. Why should we help you get a job that you are not only unqualified for, but also not willing to do the work yourself?

    You say: once u are professional dba it doesnt really matters whether u know about sql,sybase or oracle .... once u know the game u are done, ....

    I don't agree. They are very different databases, as you are showing. And it's not a 'game'.

    Take the time to learn SQL Server and then apply for a job. Or at least put forth the effort to download the Books OnLine and find the answers.

    -SQLBill

  • u are so funny,

    the time when i had to read books is over , i told u im ocp, now days companys willing to pay and train me,

    be more realistic, i told u , i have only few hours to answer he questions and they are sql specific ok? companys doesnt really care whether i know Distinct or Unique are valid keyword within sql server environment, ok?

    and knowing or not knowing this will not make much diffrence,

    u dont know about me, u dont know about the role and neither about the company, just be wise and accept the conflict and the fct that u dont know#much about the situation.

    its not as straightforward as yout thought.

    i can see your point, but its really pooor. everyone knows that we shouldnt cheat and should read and learn ourselfes,, school time is over

    hehehe

     

    if it was about cheating i wouldnt have told you !!!

     

     

     

     

  • Here you go, khoshtip!

    So far, all your queries are correct in form/syntax. The thing is, T-SQL (the language used in SQL Server) and PL-SQL (the language used in Oracle) are both ANSI compliant. This means that if you do not use special functions specific to SQL/Oracle, your query will work out fine.

    I, however, agree with SQLBill. Do your homework, then apply for the job.


    Ronald San Juan | SQL DBA
    ID 710124 ~ Code "Northwind"


  • the time when i had to read books is over


    Then, your career as a successful DBA is over.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • I try imagine myself if I hadn't read all those posts...

     

    I just can't .

  • But as a professional I do care if I am helping you get a job you cannot do. I am just aiding you at that point. As for helping you I am willing to help you gain new knowledge and understand what you are trying to do, but knowingly help you perpetrate a fraud would be wrong on my part.

  • Thanks for the professional answers and I have emailed directly to the original poster regarding the less than professional behavior.

     

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply