what is primary key?
Answers were Sorted based on User's Feedback
Answer / ramprakash
A primary key is used to uniquely identify each row in a
table
| Is This Answer Correct ? | 23 Yes | 4 No |
Answer / guest
a key is defined unique and not null in a column is called
primary key
| Is This Answer Correct ? | 17 Yes | 1 No |
A primary key is used to uniquely identify each row in a
table. It can either be part of the actual record itself ,
or it can be an artificial field (one that has nothing to
do with the actual record). A primary key can consist of
one or more fields on a table. When multiple fields are
used as a primary key, they are called a composite key.
Primary keys can be specified either when the table is
created (using CREATE TABLE) or by changing the existing
table structure (using ALTER TABLE).
Below are examples for specifying a primary key when
creating a table:
MySQL:
CREATE TABLE Customer
(SID integer,
Last_Name varchar(30),
First_Name varchar(30),
PRIMARY KEY (SID));
Oracle:
CREATE TABLE Customer
(SID integer PRIMARY KEY,
Last_Name varchar(30),
First_Name varchar(30));
SQL Server:
CREATE TABLE Customer
(SID integer PRIMARY KEY,
Last_Name varchar(30),
First_Name varchar(30));
Below are examples for specifying a primary key by altering
a table:
MySQL:
ALTER TABLE Customer ADD PRIMARY KEY (SID);
Oracle:
ALTER TABLE Customer ADD PRIMARY KEY (SID);
SQL Server:
ALTER TABLE Customer ADD PRIMARY KEY (SID);
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / arkchowdary
primary Key ----------- It is used to uniqely identify
each row in a table.
It is a combination of unique and Notnull.
A primary key can consist of one or more fields on a table.
When multiple fields are
used as a primary key, they are called a composite key.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / sajeda
it is defined as the candidate key that is selected to
identyfi tuple uniqly within a relation.
* it is not contain null value.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / kiran
to simply answer this question - a primary key is something
which has both unique and not null constraints on the
colums-table
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / dhanu
A column that has completely unique data throughout the
table is known as Primary Key.
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / parthiban.s
primary Key is a unique one.in a table only one primary
key is available. it;s not accepted null values
| Is This Answer Correct ? | 1 Yes | 2 No |
What are the values that can be specified for OPTIMIZER MODE Parameter ?
What is ordinary table in oracle?
How would you change old and new values in an insert, delete and update triggers?
If I have a select statment which retrives 2 rows, & that rows have the same data in all the fields except the last field and I want to merge the 2 rows to be in 1 row with concatenating the last field which have the different data.... eg: the 1st row has these fields: A-B-C the second row has: A-B-X ........ i want to merge the two row to be in one row like ----> A- B- C,X
difference between bind variable and variable
Explain the use of rows option in exp command.
What is a server parameter file in oracle?
How many anonymous blocks can be defined?
How to define a procedure inside another procedure?
What is an oracle user role?
Where do you use decode and case statements?
How to check database size in Oracle?