sql logics1

  • Insufficient information to answer:

    1. How many rows are in this TOYS table to begin with?

    2. As asked earlier, how do the people "see" the "12" rows?

    a. GUI?

    b. Executing a query?

    i. Are any of the queries using any query hints?

    ii. Is there any ordering criteria specified for any of the queries?

    iii. Is the TOP clause specified for any of the queries?

    3. What is each sessions transaction isolation level?

    4. Are implicit or explicit transactions being used with the insert statements?

    5. Do you know how turning off auto commit changes things?

    All of these will change the answers. William can even get an error... depending on the answers to these questions.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • asranantha (8/16/2012)


    hi firend i have small doubt in sql plz tell me answer

    Auto commit has been turned off.

    1- William logs into the database

    2- Julianna logs into the database

    3- William sees 12 rows in the TOYS table

    4- Isabelle logs into the database

    5- Julianna sees 12 rows in the TOYS table

    6- William inserts two rows into the TOYS table

    7- Julianna inserts 14 rows into the TOYS table

    8- Isabelle issues a COMMIT

    9- William issues a ROLLBACK

    10- Julianna looks at the TOYS table

    Based on the scenario above, how many rows does Julianna see in the TOYS table when she looks at it in step 10?

    plz tell me the logic .and tell me the process

    Ignoring semantic issues about people seeing rows, Julianna will "see" 26 rows. I'm assuming your test/interview is over at this point, since we're past the weekend.

    She'll see the original 12, plus the 14 she's inserted. Nobody else will be able to "see" her rows, because they haven't been committed into the table yet, but she will.

    Isabelle doesn't have anything to commit, so she's wasting her time. William can roll back his 2 rows, and does. None of the rest of it matters. 12 original, plus 14 new that only Julianna can see at this time. Assuming standard isolation levels, of course.

    On the point of this obviously being an interview/test/homework question, I'll advise you to stop trying to cheat on those things. It's unethical, and it won't do you any good in the long run.

    If it's an interview, and you get the job by cheating on the interview questions, what's going to happen when they hire you? You won't be able to do the job, so you'll just get fired very quickly, at best. In some countries, they can even sue you for fraud if you do that.

    If it's a test or homework, then the purpose of taking a class is to learn something. If all you teach yourself is how to cheat, then you should expect to spend your life being hated, possibly even in prison, because cheaters and frauds are despised by honest people.

    It takes cowardice to cheat, and courage to face the truth.

    So, does our aversion to helping someone cheat make sense now?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 16 through 16 (of 16 total)

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