1) Create table BOOK with fields namely: Book_No, Book_Tiltle,Price,Qty, and Author.Create another table BOOK_ISSUE with the fields namely: Book_No, Student_name, Issue_Date,Return_Datea) Now, decide the primary key and foreign key in the above tables.
Answers
Answered by
6
- Create table Book(Book_No int Primary Key, Book_Title varchar(50), Price int, Qty int, Author varchar(50));
- Create table Book_Issue(Book_No int Primary Key, Student_name varchar(50), Issue_date date, Return_date date);
The Primary keys would be Book_No for both the tables. Since a Primary key must be a unique value and helps eliminate data redundancy, and book numbers cannot be the same, they can be categorized as Primary keys.
The Foreign keys would also be Book_No for both the tables. A Foreign key acts as a point of reference to another table. Since the book number in the first table is for storage purposes and the book number in the second table is to help understand which book has been issued from the Book table, Book_No is the Foreign key for both the tables.
Similar questions