Computer Science, asked by aarchi82, 11 months ago

make a program to show the work of primary key and output also

please I will mark u as brainlist

Answers

Answered by ravindrakumarmeena13
1
The SQL PRIMARY KEY is a column in a table which must contain a unique value which can be used to identify each and every row of a table uniquely.

However, SQL supports primary keys directly with the PRIMARY KEY constraint.
primary key ignores a repeated value. ------------------------------------------------------------------- ------------------------------------------------------------------- -------------------------------------------------------------------
please mark as brainliest
hope it helps
Attachments:

aarchi82: what is SQL
Answered by siddhartharao77
1

Primary key:

(i) It is a Combination of unique and not null.

(ii) It is a single field of combination of fields that uniquely identifies a record.

Sample Program:

Create table Demo(eno number(10) constraint con primary key, ename varchar2(10));

(i)

Insert into Demo values(1,'A');

When you tried to insert a record with already existing 'eno' then system will raise an error.

Insert into Demo values(1,'B);

ORA-00001: unique constraint violated.


(ii)

Even null values are not allowed as constraint added is 'Primary Key'.

Insert into Demo values(Null,'C');

ORA-01400: cannot insert null into(",");


Note: Primary key constraint cannot be added to a column that already contains duplicates or Null values.


<!Hope this information helps-->

Similar questions