I need to create 3 tables which look like this
student(sid: CHAR(12), sname: VARCHAR(50), bdate: DATE, address: VARCHAR(50), scity: VARCHAR(20), year: CHAR(20), gpa: FLOAT)
company(cid: CHAR(8), cname: VARCHAR(20))
apply(sid: CHAR(12), cid: CHAR(8))
(Bolded attributes are primary keys)
But I'm not sure how to set the foreign keys since for instance cid of apply table is both primary key in apply table and company table ( which has the same situation for sid between apply table and student table). Thanks for any help.
These are the codes for creating tables:
myQuery = "CREATE TABLE student "
+ "(sid CHAR(12), sname VARCHAR(50), "
+ "bdate DATE, address VARCHAR(50), "
+ "scity VARCHAR(20), year CHAR(20), "
+ "gpa FLOAT) ENGINE=InnoDB;";
myQuery = "CREATE TABLE company "
+ "(cid CHAR(8), cname VARCHAR(20), quota CHAR(8))ENGINE=InnoDB;";
myQuery = "CREATE TABLE apply "
+ "(sid CHAR(12), cid CHAR(8)) ENGINE=InnoDB;";