我想在let dict = self.arr.objectAtIndex(indexPath.row) as! NSMutableDictionary
let 2ndview = self.storyboard?.instantiateViewControllerWithIdentifier("2ndview") as! viewcontroller
2ndview.dict = dict
self.navigationController?.pushViewController(2ndview, animated: true)
列下的course
字段中插入多个student_id
,其中每个值都与course_taken
分开。
','
有可能吗?
答案 0 :(得分:4)
course_taken
应该是M:N
和student
之间的course
关系。它是在关系数据库中使用单独的表实现的,而不是内联数据。
简单地说:
CREATE TABLE course (
id int NOT NULL PRIMARY KEY autoincrement,
course_code varchar NOT NULL
);
CREATE TABLE student (
id int NOT NULL PRIMARY KEY autoincrement,
full_name varchar NOT NULL
);
CREATE TABLE course_taken (
course_id int NOT NULL,
student_id int NOT NULL,
CONSTRAINT pk_course_taken
PRIMARY KEY (course_id, student_id),
CONSTRAINT fk_course_taken_course_id
FOREIGN KEY (course_id)
REFERENCES course (id)
ON DELETE CASCADE,
CONSTRAINT fk_course_taken_student_id
FOREIGN KEY (student_id)
REFERENCES student (id)
ON DELETE CASCADE
);
要回答您的问题,是的,您可以将这些数据内联存储在某些文本字段中。但你真的不应该。