.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

What Are Primary Keys?

Posted By :Ghanashyam Nayak     Posted Date :December 21, 2010    Points :15   Category :Sql Server 
Primary keys are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key.

You can also find related Interview Question to What Are Primary Keys?  below: 

What are primary keys and foreign keys?

  
Primary keys are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key.
Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables.


Shashi Ray (More...)

What is the difference between unique and primary keys in Oracle SQL?

  
A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The columns that compose PrimaryKey are automatically defined as NOT NULL, whereas a column that compose a UNIQUE is not automatically defined to be mandatory must also specify the column is NOT NULL.
(More...)

What are primary keys and foreign keys?

  
Primary keys are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key.
Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables. (More...)

Is it possible to create cookies with keys? Explain using some example.

  
Yes, it is possible to create cookies with keys.
Cookies is a dictionary at the time of initialization, if key is specified with it. (You can determine whether cookie is dictionary or not using HasKeys property. )
For an example:

Response.Cookies("Testcookie")("key1") = "key1"
Response.Cookies("Testcookie")("key2") = "key2"

After this if you make assignment like,
Response.Cookies("Testcookie") = "noKey"
Then," key1" and "key2" of cookie("Testcookie") will be deleted. (More...)

How To retrive Duplicate Records when There is no Primary key in a Table?

  
select city_name
from areas
group by city_name

having count(*) > 1 (More...)

What's 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 doesn't allow NULLs, but unique key allows one NULL only. (More...)

What's the difference between a primary key and a unique key?

  
Both primary key and unique key enforces 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 doesn't allow NULLs, but unique key allows one NULL only (More...)

what is the difference between primary key and foreign key?

  
A primary key is a column which uniquely identifies the
records in a table. In a broad sense, a primary key is the
mixture of a unique key and an index: A collumn with a primary
key is indexed to deliver a faster query, and doesn't allow
duplicate values to ensure specific data.

A foreign key is a column (the child collumn) in a table which
has a corresponding relationship and a dependency on another
collumn (the parent collumn) that is usually in a different
table. Parent collumns can have multiple child collumns, but a
child collumn can only have one parent collumn.

Primary key does't allow null value
while foreign key allow null value
(More...)

How do we get primary key information in oracle table?

  
we can get primary key information with the following SQL statement

SELECT b.table_name, b.column_name, b.position, a.status, cons.owner
FROM all_constraints a, all_cons_columns b
WHERE cons.constraint_type = 'P'
AND a.constraint_name = b.constraint_name
AND a.owner = b.owner
ORDER BY b.table_name, b.position;
(More...)

What Are Foreign Keys?

  
Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables. (More...)

Difference between primary and unique key constraints

  
Unique Key Constraints
The column values should retain uniqueness.
It allows null values in the column.
It will create non-clustered index by default.
Any number of unique constraints can be added to a table.


Primary Key Constraints
Primary key will create column data uniqueness in the table.
It will not allow Null values.
By default Primary key will create clustered index.
Only one Primary key can be created for a table.
(More...)

What is Primary Interop Assembly (PIA)?

  
This is an assembly that contains the type definitions that is metadata of types, which is implemented with COM. This can snatch up multiple versions of the same type library. These are needs to be signed with a strong name by the publisher of the COM type library. This library imported as an assembly when it has been signed. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend