Database Design

 

create table students (student_id char(7) not null, name char(30) not null, class char(2) not null, class_no int unsigned not null, unique classno (class,class_no), primary key (student_id) );

create table books (isbn char(12) not null, title char(50) not null, subject char(20) not null, first_published date not null, primary key (isbn));

create table loans ( loan_no char(10) not null, student_id char(7) not null, isbn char(12) not null, date_of_return date not null, primary key (loan_no), foreign key (student_id) references students(student_id) on update cascade on delete restrict, foreign key (isbn) references books(isbn) on update cascade on delete restrict);

You have not entered the SQL statement.