Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is primary key?

Answer Posted / vinod singh kushwah

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How would you begin to troubleshoot an ORA-3113 error?

2080


Name the various constraints used in oracle?

1022


Select all the employees who were hired in last 2 years and who works in dept where max managers are working.

2972


How to retrieve the count of updated rows?

1128


How to convert csv to table in oracle?

992


How to establish administrator authentication to the server?

1043


I have a table called 'test' on source and target with same name, structure and data type but in a different column order. How can you setup replication for this table?

1114


What is a proxy class?

1059


What is the sid in oracle?

968


Give the various exception types.

996


How to view all columns in an existing table?

936


What is the difference difference between $ORACLE_HOME and $ORACLE_BASE.

1109


What are the data types in oracle?

1040


What is a nested table and how is it different from a normal table?

1054


How to export several tables together?

1049