Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

sql logics1 Expand / Collapse
Author
Message
Posted Thursday, August 16, 2012 1:35 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 3:48 AM
Points: 209, Visits: 4,502
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
Post #1345701
Posted Thursday, August 16, 2012 2:00 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:03 PM
Points: 42,485, Visits: 35,554
Interview question? Homework?

That's not hard to implement and test.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
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

Post #1345719
Posted Thursday, August 16, 2012 5:00 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 3:48 AM
Points: 209, Visits: 4,502
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
Post #1345830
Posted Thursday, August 16, 2012 5:21 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:03 PM
Points: 42,485, Visits: 35,554
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 2008, MVP
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

Post #1345852
Posted Thursday, August 16, 2012 10:30 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 3:48 AM
Points: 209, Visits: 4,502
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
Post #1346114
Posted Thursday, August 16, 2012 10:38 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:45 PM
Points: 23,081, Visits: 31,620
asranantha (8/16/2012)
answere is 28 rows


You sure?



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)
Post #1346117
Posted Thursday, August 16, 2012 10:43 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 11:23 AM
Points: 2,691, Visits: 3,376
Second question... What does Isabelle see when she runs a commit?

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
SQL Know-It-All

How to post data/code on a forum to get the best help - Jeff Moden
Post #1346118
Posted Thursday, August 16, 2012 10:55 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:03 PM
Points: 42,485, Visits: 35,554
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 2008, MVP
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

Post #1346123
Posted Thursday, August 16, 2012 11:02 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 11:23 AM
Points: 2,691, Visits: 3,376
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
SQL Know-It-All

How to post data/code on a forum to get the best help - Jeff Moden
Post #1346126
Posted Thursday, August 16, 2012 11:24 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 3:48 AM
Points: 209, Visits: 4,502
why isbbelle gets erroe
and williams inserts 2 rows +julianna insert 12 rows are not lodead in in toy table how u say thatone
Post #1346140
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse