+1 vote
81 views
in Database Management Systems by

1 Answer

+1 vote
by
selected by (user.guest)
 
Best answer

Technically, a primary key constraint is simply a combination of a unique constraint and a not-null constraint. So, the following two table definitions accept the same data:  

CREATE TABLE products (product_no integer UNIQUE NOT NULL, name text, price numeric);  

CREATE TABLE products (product_no integer PRIMARY KEY,name text, price numeric);  

Primary keys can also constrain more than one column; the syntax is similar to unique constraints:  

CREATE TABLE example (a integer,b integer,c integer, PRIMARY KEY (a, c));

A primary key indicates that a column or group of columns can be used as a unique identifier for rows in the table. (This is a direct consequence of the definition of a primary key. Note that a unique constraint does not, in fact, provide a unique identifier because it does not exclude null values.) This is useful both for documentation purposes and forclient applications. For example, a GUI application that allows modifying row values probably needs to know the primary key of a table to be able to identify rows uniquely.

Related questions

+3 votes
1 answer 347 views
+1 vote
1 answer 71 views
+1 vote
1 answer 75 views
+1 vote
1 answer 185 views
+1 vote
1 answer 177 views
+1 vote
1 answer 113 views
0 votes
2 answers 159 views
asked Sep 19 in Computational Tools by (user.guest)
+1 vote
2 answers 165 views
+1 vote
1 answer 149 views
+1 vote
1 answer 601 views
0 votes
1 answer 19 views
+1 vote
1 answer 292 views
+1 vote
1 answer 131 views
+1 vote
1 answer 98 views
+1 vote
1 answer 90 views
+2 votes
1 answer 1.1k views
+3 votes
1 answer 3.0k views
+1 vote
1 answer 929 views
+2 votes
1 answer 1.8k views
+3 votes
1 answer 4.2k views
0 votes
1 answer 62 views
0 votes
1 answer 61 views
+1 vote
1 answer 80 views
+1 vote
1 answer 113 views
+1 vote
1 answer 152 views
+1 vote
1 answer 190 views
+1 vote
1 answer 88 views
+2 votes
1 answer 408 views
+2 votes
1 answer 502 views
+2 votes
1 answer 754 views
+2 votes
1 answer 378 views
+1 vote
1 answer 490 views
+2 votes
1 answer 478 views
+1 vote
1 answer 1.7k views
+1 vote
1 answer 1.6k views
+1 vote
1 answer 579 views
Welcome to CPENTalk.com
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

...