SQL SERVER – Query Hint – Contest Win Joes 2 Pros Combo (USD 198) – Day 1 of 5

August 2011 we ran a contest where every day we give away one book for an entire month. The contest had extreme success. Lots of people participated and lots of give away. I have received lots of questions if we are doing something similar this month. Absolutely, instead of running a contest a month long we are doing something more interesting. We are giving away USD 198 worth gift every day for this week. We are giving away Joes 2 Pros 5 Volumes (BOOK) SQL 2008 Development Certification Training Kit every day. One copy in India and One in USA. Total 2 of the giveaway (worth USD 198). All the gifts are sponsored from the Koenig Training Solution and Joes 2 Pros.

The books are available here Amazon | Flipkart 

How to Win:

  • Read the Question
  • Read the Hints
  • Answer the Quiz in Contact Form in following format
    • Question
    • Answer
    • Name of the country (The contest is open for USA and India residents only)
  • 2 Winners will be randomly selected announced on August 20th.

Question of the Day:

Which of the following queries will return dirty data?

a) SELECT * FROM Table1 (READUNCOMMITED)
b) SELECT * FROM Table1 (NOLOCK)
c) SELECT * FROM Table1 (DIRTYREAD)
d) SELECT * FROM Table1 (MYLOCK)

Query Hints:

BIG HINT POST

Most SQL people know what a “Dirty Record” is. You might also call that an “Intermediate record”. In case this is new to you here is a very quick explanation. The simplest way to describe the steps of a transaction is to use an example of updating an existing record into a table. When the insert runs, SQL Server gets the data from storage, such as a hard drive, and loads it into memory and your CPU. The data in memory is changed and then saved to the storage device. Finally, a message is sent confirming the rows that were affected.

For a very short period of time the update takes the data and puts it into memory (an intermediate state), not a permanent state. For every data change to a table there is a brief moment where the change is made in the intermediate state, but is not committed. During this time, any other DML statement needing that data waits until the lock is released. This is a safety feature so that SQL Server evaluates only official data.

For every data change to a table there is a brief moment where the change is made in this intermediate state, but is not committed. During this time, any other DML statement (SELECT, INSERT, DELETE, UPDATE) needing that data must wait until the lock is released. This is a safety feature put in place so that SQL Server evaluates only official data.

Additional Hints:

I have previously discussed various concepts from SQL Server Joes 2 Pros Volume 1.

Next Step:

Answer the Quiz in Contact Form in following format

  • Question
  • Answer
  • Name of the country (The contest is open for USA and India)

Bonus Winner

Leave a comment with your favorite article from the “additional hints” section and you may be eligible for surprise gift. There is no country restriction for this Bonus Contest. Do mention why you liked it any particular blog post and I will announce the winner of the same along with the main contest.

Reference: Pinal Dave (http://blog.sqlauthority.com)

25 thoughts on “SQL SERVER – Query Hint – Contest Win Joes 2 Pros Combo (USD 198) – Day 1 of 5

  1. Option B is the correct answer. Because if u don’t put a lock on the records and at the same time if multiple users are concurrently accessing / updating the data then it will lead to the dirty reads

    Like

  2. Hi Pinal,

    I am interested to this contest. One of the winner in August 2011 contest.[Day 26]

    In Addition Hints Section from SQL Server Joes 2 Pros Volume 1, i had check with all the links and my favorite link as below :

    SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Finding Apostrophes in String and Text – Day 3 of 35

    Reason : Most of the technical guys are just struck to face this difficulties in their working scenarios. Its simple thing but most of them feel difficult at the time of facing first time in their working environment.

    Like

  3. Hi Pinal Dave,

    SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Row Constructors – Day 6 of 35

    I have seen this post. Its very nice to add more record in a single query. And also I have used in my project also.

    Like

  4. Hi sir,

    This is very interesting event and i would like “SQL Joes 2 Pros Development Series – Dirty Records and Table Hints” because as stated in that blog post your answer for the question is pretty much sure and lots of people given the correct answer but as i read the hole comments i’m very much comfortable with the question and your answer…!!!!

    Thanks
    Ganesh N

    Like

  5. Hi Sir,

    SQL Joes 2 Pros Development Series – Wildcard – Querying Special Characters
    and
    SQL Joes 2 Pros Development Series – Dirty Records and Table Hints

    are my favourite links that is in my book marks.. :)
    Just loved the way the concept is explained

    Regards,
    Anish Shenoy,
    Quadwave,
    Bangalore

    Like

  6. Pingback: SQL SERVER – Contest – Summary of 5 Day and Additional Information « SQL Server Journey with SQL Authority

  7. Hi Pinal,
    I liked the additional hint – SQL Joes 2 Pros Development Series – Dirty Records and Table Hints as in this blog it is mentioned very clear for dirty records.

    Best Regards,
    S Kumar

    Like

  8. Question :
    Which of the following queries will return dirty data?

    b) SELECT * FROM Table1 (NOLOCK)

    Favorite Article:
    SQL Joes 2 Pros Development Series – Wildcard – Querying Special Characters

    Like

  9. question: Which of the following queries will return dirty data?
    Answer is B: Select * from Table1 (NOLOCK) will return dirty data.

    Country: USA

    Thank You
    Uday

    Like

  10. Pingback: SQL SERVER – Winners – Contest Win Joes 2 Pros Combo (USD 198) « SQL Server Journey with SQL Authority

  11. Pingback: Here comes my Free Copy of Joes 2 Pros Combo – Courtesy Pinal Dave « Datta's Ramblings on Business Intelligence 'N' Life

  12. Pingback: SQL SERVER – Weekly Series – Memory Lane – #041 | Journey to SQL Authority with Pinal Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s