Explain the difference between primary keys and foreign keys?
Answer / Sonam Sidhu
Primary Key is a unique column or set of columns in a table that is used to identify each row uniquely. It cannot contain NULL values. A Primary Key ensures data integrity and enforces uniqueness of rows within a table. Foreign Key, on the other hand, is a column (or set of columns) in one table that refers to the primary key in another table. It is used to establish a relationship between two or more tables in a database.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to update a field in SQL after ALTERING a row?
What is Dedicated Administrator Connection in sql server 2005?
what is the maximum size of a row in sql server 2000 and 2005
what is denormalization and when would you go for it? : Sql server database administration
how to delete duplicate rows from table in sql server
12 Answers HCL, UHG,
Is it possible to have more then one foreign key in a single table? if possible, is this the good way to design the table?
What is difference between index and primary key?
How to execute a stored procedure in ms sql server?
Write a SQL query to delete a table?
What is ACID Property of Transaction?
Explain basic SQL queries with SELECT from where Order By, Group By-Having?
What is compression - row-level and page-level compression?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)