DATABASE - Answer 8-11 Answer 8-11 only Given the following samples of larger ta
ID: 3863426 • Letter: D
Question
DATABASE - Answer 8-11
Answer 8-11 only
Given the following samples of larger tables, give the queries for the problems below STUDENT Name StudentID Class Major CS Brown Class is 1 for Freshman, 2 for Sophomore, 3 for Junior and 4 for Seniors COURSE Credit hours CourselD Name Department CS101 intro. to Computer Science CS191 Discrete Struct I 3 CS282 Assembly Language 4 OBOE 101 OBOA Freshman Oboe SECTION SectionID Course ID Semester Year Faculty ID 2014 OBOE 101 BBishop 781 CS101 541 2014 KBingham 2014 552 CS101 BHare CS101 2014 BHare 448 662 CS191 FS 2014 XLiuExplanation / Answer
1. CREATE TABLE Student(
Name varchar(255),
StudentID int NOT NULL,
Class int,
Major varchar(10),
PRIMARY KEY (StudentID)
);
2. CREATE TABLE Course(
CourseID varChar(10) NOT NULL,
Name varchar(10),
Credit_hours int,
Department varchar(10),
PRIMARY KEY (CourseID )
);
3. CREATE TABLE Course(
CourseID varChar(10) NOT NULL,
Prequisite_CourseID varchar(10),
PRIMARY KEY (CourseID, Prequisite_CourseID),
FOREIGN KEY (CourseID ) REFERENCES Course(CourseID),
FOREIGN KEY (Prequisite_CourseID ) REFERENCES Course(CourseID)
);
4. select name, studentId from Student where Major='CS'
5. select name from course INNER JOIN section ON course.courseId = section.courseId AND (Section.year = 2012 OR Section.year = 2013)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.