title: Converting an ER diagram to SQL code
body: <p><img src="https://i.stack.imgur.com/EYKks.jpg" alt="enter image description here"></p>
  
  <p>This is the ER diagram, for which tables have to be made in SQL code implementing all the constraints. I made tables and tried implementing all the relationship via foreign keys, i jus wanted to confirm, whether these tables are correct or not.</p>
  
  <p>1) Department table:</p>
  
  <pre><code>create table department(dpet_id number primary key, dept_name varchar2(15)
  not null);
  </code></pre>
  
  <p>2) Branch table:</p>
  
  <pre><code>create table branch(branch_id varchar2(5) primary number, electives varchar2(10),
  dept_id number references department(dept_id));
  </code></pre>
  
  <p>3) Course table:</p>
  
  <pre><code>create table course(course_id number primary key, course_name varchar2(10)
  not null,branch_id varchar2(5) references branch(branch_id));
  </code></pre>
  
  <p>4) Student table:</p>
  
  <pre><code>create table student(stud_id number primary key, stud_name varchar2(30) not null,
  branch_id varchar2(5) references branch(branch_id);
  </code></pre>
  
  <p>5) Applicant table:</p>
  
  <pre><code>create table applicant(app_id number primary key, stud_id number constraint fk
  references student(stud_id) constraint stu_unq unique);
  </code></pre>
  
  <p>6) Applicant_branch table:</p>
  
  <pre><code>create table applicant_branch(app_id number references applicant(app_id),
  branch_id varchar2(5) references branch(branch_id));
  </code></pre>
  
  <p>Do these tables conform to the ER diagram ?</p>