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 to define a record variable to store a table row?

1002


I creat Credit memo in AR. Now i want revers the Credit Memo.how you can revers that what out any aditional entry.

2259


How to estimate disk space needed for an export job?

990


What is an oracle?

956


What is an oracle database?

989


What is a data dictionary and how can it be created?

1055


State and explain the different types of data models?

894


Explain about functional dependency and its relation with table design?

952


How to retrieve data from an cursor to a record?

1012


What are the differences between char and varchar2 in oracle?

1072


definition of cluster and non-clustered index?

2959


How can I see all tables in oracle?

950


What is oracle open database communication (odbc)?

960


Is there a combination of "like" and "in" in sql?

1004


What is flashback in Oracle?

963