Computer Science
Answer
| Primary key | Candidate key |
|---|---|
| A primary key is a set of one or more attributes/fields which uniquely identifies a tuple/row in a table. | A candidate key refers to all the attributes in a relation that are candidates or are capable of becoming a primary key. |
| There can be only one primary key per table. | A table can have multiple candidate keys. Only one of them is chosen as the primary key. |
Related Questions
Write SQL commands for (i) to (vi) on the basis of relations given below:
Table: BOOKS
Book_ID Book_name Author_name Publishers Price Type qty K0001 Let us C Y. Kanetkar EPB 450 Prog 15 P0001 Computer Networks B. Agarwal FIRST PUBL 755 Comp 24 M0001 Mastering C++ K.R. Venugopal EPB 165 Prog 60 N0002 VC++ advance P. Purohit TDH 250 Prog 45 K0002 Programming with Python Sanjeev FIRST PUBL 350 Prog 30 L02 Computer Science with Python Sumita Arora Dhanpat rai 655 Prog 16 L04 Computer Science with Python Preeti Arora Sultan chand 550 Prog 20 L05 Concise Mathematics R.K.Bansal Selina 600 Maths 10 Table: ISSUED
Book_ID Qty_Issued L02 13 L04 5 L05 21 (i) To show the books of "FIRST PUBL" Publishers written by P.Purohit.
(ii) To display cost of all the books published for FIRST PUBL.
(iii) Depreciate the price of all books of EPB publishers by 5%.
(iv) To display the bookname and price of the books, more than 3 copies of which have been issued.
(v) To show total cost of books of each type.
(vi) To show the details of the costliest book.
What are DDL and DML?
What do you understand by the terms Cardinality and Degree of a relation in relational database?
Differentiate between DDL and DML. Mention the two commands for each category.