Create table shows ERROR 1005(HY000) errno 150
You are missing column name of parent table to which your child refer, while creating child table, do like below

create table department
(dept_name      varchar(20), 
 building       varchar(15), 
 budget             numeric(12,2),
 primary key (dept_name)
);

create table course
(course_id      varchar(8), 
 title          varchar(50), 
 dept_name      varchar(20),
 credits        numeric(2,0),
 primary key (course_id),
 foreign key (dept_name) references department(dept_name)
);