SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sql logics1


sql logics1

Author
Message
asranantha
asranantha
SSC-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 4717
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
GilaMonster
GilaMonster
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88316 Visits: 45277
Interview question? Homework?

That's not hard to implement and test.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


asranantha
asranantha
SSC-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 4717
how can u gues it is interview question? and in case of its interview question why ur not help?ok if u know answer tell me answers its help other wise donot comments unnecessary
GilaMonster
GilaMonster
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88316 Visits: 45277
Because it's blatantly obvious that it's a set question. We don't just give out answers to interview questions, it doesn't help you learn and I don't need the job.

Seriously, create a table, create three SSMS sessions and do what's in that list and see how many rows. You'll remember the answer (and possibly the reason) far better than if someone just gives you the answer.

Also, read up on transactions and rollbacks for the theory behind why it works

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


asranantha
asranantha
SSC-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 4717
answere is 28 rows
here there is no logic just thinking
like this way

first step first persion enter to the database
in second step second persion enter to the database
in third step william sees 12 rows in the toys table that means toys table contain
12 rows
in fourt step third persion log on to the same database
in fifth step second persion sees 12 rows in the toys table that time also toys table
contains 12 rows
in sixth step first persion insert 2 rows into the toyps table that time toys table
contain 14 rows
in sevents step second persion insert 14 rows into the toys table that time toys table
contain 28 rows
in eighth step second persion issues the commit that means all rows are commit
so 28 rows are commit in toys table
in ninth step first pesion issue rollback that time also 28 rows avilable in toys table
in 10th step third persion look to toys table that time he sees 28 rows in toys table
Lynn Pettis
Lynn Pettis
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39866 Visits: 38563
asranantha (8/16/2012)
answere is 28 rows


You sure?

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Jared Karney
Jared Karney
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5002 Visits: 3694
Second question... What does Isabelle see when she runs a commit? w00t

Also, the question is incomplete. Like asking how many car lengths are between me and that tree over there?... A car is not a unit of length. Looking at a table is not a defined construct. Querying a table is also not a defined construct, as there are several ways to structure that query.

Thanks,
Jared
PFE - Microsoft
SQL Know-It-All
How to post data/code on a forum to get the best help - Jeff Moden
GilaMonster
GilaMonster
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88316 Visits: 45277
So you're saying that if you and I are both making changes to a table at the same time, when you run a commit you also commit my changes and then if I decide that I want to undo my changes, I can't roll them back because you already committed them?

Sure that's how transactions work? (hint, look up the meaning of ACID as it applied to transactions, specifically what the I stands for and means)

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Jared Karney
Jared Karney
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5002 Visits: 3694
1- William logs into the database
2- Julianna logs into the database
3- William sees 12 rows in the TOYS table
How does he "see" 12 rows? SELECT TOP 12? SELECT *? WITH(NOLOCK)? GUI?
4- Isabelle logs into the database
5- Julianna sees 12 rows in the TOYS table
Again... How does she "see" 12 rows? SELECT TOP 12? SELECT *? WITH(NOLOCK)? GUI?
6- William inserts two rows into the TOYS table
7- Julianna inserts 14 rows into the TOYS table
8- Isabelle issues a COMMIT
Isabelle gets an error...
9- William issues a ROLLBACK
10- Julianna looks at the TOYS table
Once again... How does she "see" 12 rows? SELECT TOP 12? SELECT *? WITH(NOLOCK)? GUI?

Thanks,
Jared
PFE - Microsoft
SQL Know-It-All
How to post data/code on a forum to get the best help - Jeff Moden
asranantha
asranantha
SSC-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 4717
why isbbelle gets erroe
and williams inserts 2 rows +julianna insert 12 rows are not lodead in in toy table how u say thatone
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search