Day-14) Identity columns in sql server with interview questions in hindi #database #sqlserver



Day-14) Identity columns in sql server with interview questions in hindi #database #sqlserver

Day-14) Identity columns in sql server with interview questions in hindi #database #sqlserver

These are the interview questions from my last video.
Q.) Can we create a table with multiple unique, foreign, or primary keys in SQL Server?
A.) We can create a table in SQL Server with multiple unique and foreign keys. But it is not
possible to create a table can with multiple primary keys in SQL Server.

Q.) Is it possible that a foreign key references a non-primary key in SQL Server?
A.) Yes, it is possible. The point that you need to keep in mind is that a foreign key actually references a key that should contain unique values. So it may be a primary key or unique key as both keys maintain the uniqueness of the column of a table.

Q.) Can a foreign key accept null values in SQL Server?
A.) Yes, a foreign key in SQL Server can accept NULL values. This is because a Foreign key can reference unique or non-primary keys which may hold NULL values.

What is Identity in SQL Server?
The Identity in SQL Server is a property that can be applied to a column of a table whose value is automatically created by the server. So, whenever you marked a column as identity, then that column will be filled in an auto-increment way by SQL Server. That means as a user we cannot insert a value manually into an identity column.
Syntax: IDENTITY [(seed,increment)]
Arguments:
Seed: Starting value of a column. The default value is 1.
Increment: It specifies the incremental value that is added to the identity column value of the previous row. The default value is 1.

Create Table Person
(
PersonId int identity(1, 1),
Name nvarchar(20)
)
Insert into Person values (‘Bob’)
Insert into Person values (‘James’)

#sql #mysql #thisisqld #sqlserver #sqlab #nosql #postgresql #whitsundaysqld #jsuisqlf #northlakesqld #pacosqlos #redlandsqld #esql #gatosqls #sqlinjection #sqlimer #pacosqls #mssql #southerndownsqld #igersqld #sqldeveloper #plsql #batsqld #sqlite #nswvsqld #cmcrocksqld #nationalparksqld #pacosql #bestplacesqld #sqlsaturday #holtyspicsqld #cairnsqld #sqlmiami #mysqli #phpmysql #unicefmasqla #sqlife #smallbusinessqld #personalisedplatesqld #oldsql #sql #python #java #javascript #programming #html #database #sqlserver #css #php #coding #developer #programmer #software #datascience #mysql #o #webdeveloper #machinelearning #code #audiomobil #sqldeveloper #spl #computerscience #sq #oracle #webdevelopment #data #dataanalytics #linux #technology #computer #development #bigdata #backend #programador #coder #codinglife #caraudio #microsoft #csharp #sqldatabase #softwaredeveloper #informationtechnology #tecnologia #mongodb #powerbi #developers #c #it #worldcode #ti #web #programminglife #softwaredevelopment #artificialintelligence #ai #cienciadacomputacao #angular #programmerslife