Sie sind auf Seite 1von 3

1. Whats the difference between a primary key and a unique key?

Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesnt allow NU s, but unique key allows one NU only.
2. Write a SQL Query to find first Week Day of month?

!" "#$ %A$"NA&"'dw, %A$"A%%'dd, ( %A$")A*$'dd, +"$%A$"',, - ., +"$%A$"',,, A! /irst%ay


. !ow to find "th hi#hest sa$ary from %mp$oyee tab$e

!" "#$ $0) . salary /*0& '!" "#$ %1!$1N#$ $0) 2 salary /*0& employee
ORDER BY salary DESC) a ORDER BY salary
&. What is a 'oin and List different types of 'oins.

Joins are used in queries to explain how different tables are related. Joins also let you sele t data fro! a table dependin" upon data fro! another table. #ypes of $oins% &''ER JO&'s( O)#ER JO&'s( CROSS JO&'s. O)#ER JO&'s are further lassified as *E+# O)#ER JO&'S( R&,-# O)#ER JO&'S and +)** O)#ER JO&'S. You an use index hint .index/index0na!e) after the table na!e. SE*EC# au0lna!e +RO1 authors .index/aun!ind)
". What is sortin# and what is the difference between sortin# and c$ustered inde*es? (. !ow can ) enforce to use particu$ar inde*?

#he ORDER BY lause sorts query results by one or !ore olu!ns up to 2(343 bytes. #his will happen by the ti!e when we retrie5e data fro! database. Clustered indexes physi ally sortin" data( while insertin"6updatin" the table. 7 $oin sele ts
+. What are the differences between ,-).- and /.)-S?

olu!ns fro! 8 or !ore tables. 7 union sele ts rows.

0. What is the 1eferentia$ )nte#rity?

Referential inte"rity refers to the onsisten y that !ust be !aintained between pri!ary and forei"n 9eys( i.e. e5ery forei"n 9ey 5alue !ust ha5e a orrespondin" pri!ary 9ey 5alue. 2343 bytes.
2. What is the row si3e in SQL Ser4er 2555?

15. !ow to determine the ser4ice pack current$y insta$$ed on SQL Ser4er?

$he 3lobal 4ariable 556ersion stores the build number of the sqlser4r.exe, which is used to determine the ser4ice pack installed. e37 &icrosoft !8 !er4er 9::: ( ;.::.<2: '1ntel =;2, %ec .< 9::9 .>7997:? #opyri3ht 'c, .@;;(9::A &icrosoft #orporation "nterprise "dition on Bindows N$ ?.: 'Build 9.@?7 !er4ice )ack A,
11. What is the purpose of ,6D78% S878)S8)9S?

Updates information about the distribution of key 4alues for one or more statistics 3roups 'collections, in the specified table or indexed 4iew.
12. What is the use of S9.6%:)D%-8)8;<= function?

*eturns the most recently created identity 4alue for the tables in the current execution scope.
1 . What are the different ways of mo4in# data>databases between ser4ers and databases in SQL Ser4er?

$here are lots of options a4ailable, you ha4e to choose your option dependin3 upon your requirements. !ome of the options you ha4e are7 BA#CU)D*"!$0*", detachin3 and attachin3 databases, replication, %$!, B#), lo3shippin3, 1N!"*$...!" "#$, !" "#$...1N$0, creatin3 1N!"*$ scripts to 3enerate data.
1&. !ow do you transfer data from te*t fi$e to database <other than D8S=?

Usin3 the B#) 'Bulk #opy )ro3ram, utility.


1(. What?s the difference between D%L%8% 87@L% and 81,-978% 87@L% commands?

%" "$" $AB " is a lo33ed operation, so the deletion of each row 3ets lo33ed in the transaction lo3, which makes it slow. $*UN#A$" $AB " also deletes all the rows in a table, but it wonEt lo3 the deletion of each row, instead it lo3s the deallocation of the data pa3es of the table, which makes it faster. 0f course, $*UN#A$" $AB " can be rolled back.
1". What is a dead$ock?

%eadlock is a situation when two processes, each ha4in3 a lock on one piece of data, attempt to acquire a lock on the otherEs piece. "ach process would wait indefinitely for the other to release the lock, unless one of the user processes is terminated. !8 !er4er detects deadlocks and terminates one userEs process.
1+. What is a Li4eLock?

A li4elock is one, where a request for an exclusi4e lock is repeatedly denied because a series of o4erlappin3 shared locks keeps interferin3. !8 !er4er detects the situation after four denials and refuses further shared locks. A li4elock also occurs when read transactions monopoliFe a table or pa3e, forcin3 a write transaction to wait indefinitely.
10. !ow to restart SQL Ser4er in sin#$e user mode?

/rom !tartup 0ptions 7( +o to !8 !er4er )roperties by ri3ht(clickin3 on the !er4er name in the "nterprise mana3er. Under the E+eneralE tab, click on E!tartup )arametersE. "nter a 4alue of (m in the )arameter.
12. Does SQL Ser4er 2555 c$usterin# support $oad ba$ancin#?

!8 !er4er 9::: clusterin3 does not pro4ide load balancin3G it pro4ides failo4er support. $o achie4e load balancin3, you need software that balances the load between clusters, not between ser4ers within a cluster.
25. What is D89?

$he &icrosoft %istributed $ransaction #oordinator '&! %$#, is a transaction mana3er that allows client applications to include se4eral different sources of data in one transaction. &! %$# coordinates committin3 the distributed transaction across all the ser4ers enlisted in the transaction.
21. What is D8S?

&icrosoftH !8 !er4erI 9::: %ata $ransformation !er4ices '%$!, is a set of 3raphical tools and pro3rammable objects that lets you extract, transform, and consolidate data from disparate sources into sin3le or multiple destinations.
22. What are defau$ts? )s there a co$umn to which a defau$t can?t be bound?

A default is a 4alue that will be used by a column, if no 4alue is supplied to that column while insertin3 data. 1%"N$1$J columns and timestamp columns canEt ha4e defaults bound to them.
2 . What are the constraints ?

$able #onstraints define rules re3ardin3 the 4alues allowed in columns and are the standard mechanism for enforcin3 inte3rity. !8 !er4er 9::: supports fi4e classes of constraints. N0$ NU , #K"#C, UN18U", )*1&A*J C"J, /0*"1+N C"J.
2&. What is 8ransaction?

A transaction is a sequence of operations performed as a sin3le lo3ical unit of work. A lo3ical unit of work must exhibit four properties, called the A#1% 'Atomicity, #onsistency, 1solation, and %urability, properties, to qualify as a transaction.
2(. What is )so$ation Le4e$? An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. A lower isolation level increases concurrency, but at the ex ense of data correctness. Conversely, a higher isolation level ensures that data is correct, but can affect concurrency negatively. The isolation level re!uired by an a lication determines the loc"ing behavior SQL Server uses. SQL#$% defines the following isolation levels, all of which are su orted by SQL Server&

Read un o!!itted .the lowest le5el where transa tions are isolated only enou"h to ensure that physi ally orrupt data is not read). Read o!!itted .S:* Ser5er default le5el). Repeatable read. Seriali;able .the hi"hest le5el( where transa tions are o!pletely isolated fro! one another).

Das könnte Ihnen auch gefallen