SQL 3
SQL 3
SQL 3
The following statement creates tblGender table, with ID and Gender columns. The
following statement creates tblGender table, with ID and Gender columns. ID column,
is the primary key column. The primary key is used to uniquely identify each row in
a table. Primary key does not allow nulls.
Create Table tblGender
(ID int Not Null Primary Key,
Gender nvarchar(50))
Foreign keys are used to enforce database integrity. In layman's terms, A foreign
key in one table points to a primary key in another table. The foreign key
constraint prevents invalid data form being inserted into the foreign key column.
The values that you enter into the foreign key column, has to be one of the values
contained in the table it points to.
Email This
BlogThis!
Share to Twitter
Share to Facebook
Share to Pinterest
27 comments:
You did a great work. We can see n number of videos and articles of many technology
in internet .but many of them are scattered . You did it in a systematic way so
that people can find it easy and read and UNDERSTAND EASY. Well Done !.
Reply
I am an absolute beginner trying to learn SQL Server and together with the book I
bought your videos on you tube are a great assistance for me. Great work, very well
organized! Excellent! Thank you!
Reply
Is it necessary that the foreign key must be the primary key of another table?Can
it be a Unique Key???
Reply
Replies
Reply
Reply
Thanks in advance.
Reply
Replies
Reply
Reply
UnknownDecember 27, 2016 at 3:34 PM
hi venkat,
you are a GEM,I am currently a Voice engineer but Now i want to learn a new
technology and hence i started following you . I have just begun watching your .net
videos .
your videos are so easy to understand ,the least that it can do is get a job to
someone who wants to achieve their goals and behind their success is your utmost
generosity of sharing these knowledgeable videos of yours.
thanks for sharing this.
Minhaj
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Reply
Let me give you a real life example. Suppose you have a database that stores sales
proposals. Suppose further that each proposal only has one sales person assigned
and one client. So your proposal table would have two foreign keys, one with the
client ID and one with the sales rep ID. However, at the time the record is
created, a sales rep is not always assigned (because no one is free to work on it
yet), so the client ID is filled in but the sales rep ID might be null. In other
words, usually you need the ability to have a null FK when you may not know its
value at the time the data is entered, but you do know other values in the table
that need to be entered. To allow nulls in an FK generally all you have to do is
allow nulls on the field that has the FK. The null value is separate from the idea
of it being an FK.
Reply
Reply
How many Primary keys and foreign keys per each table
Reply
Complete Tutorials
How to become a full stack web developer
JavaScript tutorial
Bootstrap tutorial
Important Videos
The Gift of Education
C tutorial
Angular 6 Tutorial
Angular 2 Tutorial
Design Patterns
SOLID Principles
Bootstrap
AngularJS Tutorial
jQuery Tutorial
JavaScript Tutorial
Charts Tutorial
LINQ
LINQ to SQL
LINQ to XML
Entity Framework
WCF
C#
SQL Server
ADO.NET
ASP.NET
GridView
ASP.NET MVC
Slides
Entity Framework
WCF
C#
SQL Server
ADO.NET
ASP.NET
GridView
ASP.NET MVC
Interview Questions
C#
SQL Server
Written Test
Powered by Blogger.