Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Table

Constarint
Alter table testdata3 add Constraint DF_Datae default '1' for Datae

Alter table testdata3 add Constraint Chk_Datae check (Datae>'10')

Alter table Persons add Constraint UQ_ID Unique (ID)

Alter table Persons1 add Constraint PK_ID1 Primary key (ID)

Alter table Persons_ref add Constraint Fk_ID1 foreign key (Pes_ID) references
Persons1(ID)

Cascading Referential integrity-Action which is done when we update or delete key


which referes to FK
Types-No action set null,set default and cascade- Delet the row
Identity-When a column genereates values automatically then it is a identity column
Insert explict value for Identity column Set Indentity_Insert Table_name ON
Reseed DBCC CheckIdent('table',Reseed,0)
Last Genereated Identity:-
Select IDENT_CURRENT('testdata')
Select @@IDENTITY
Select SCOPE_IDENTITY()
Wild cards
Joins
Cross Join
Inner Join
Outer Join-Left right and Full
Union and Union all used to combine the result set of two or more select statement
Stored Procedure is A group of SQL satement ,If we are in situation of using same
query over and over again we save that as a stored procedure and we can use it.
SP we can use return but have only one value
Data integrity
coveringquery

Select Deptname,isnull(count(*),'0') As count


from Department D Left Join Emp E on D.deptid=E.deptid Group by Deptname

Select Name,Salary,Dense_Rank() over(Order by Salary Desc) As Ran from Employee


Select * from employee where name like '%[a-d]%'

Isolation levels
how can we write Optimize query
input ,output in sp
diff between inline and multistatement fn
types of function
Limiation of view
Same salary
duplicate email
Manager Names
Identity
last identity Identity
Set identity on-Insert deleted identity
Determeinistic
Non deterministic
Lead Lag

You might also like