设为首页 加入收藏

TOP

外企数据库基础笔试题
2014-11-14 17:45:03 来源: 作者: 【 】 浏览:30
Tags:外企 数据库 基础 试题

Consider the following database schema, defined in SQL.
Drop table courseSelection;
Drop table course;
Drop table student;
Drop table teacher;
CREATE TABLE Teacher(teacherId int,
teacherName varchar(20),
PRIMARY KEY (teacherId));
CREATE TABLE student(studentId int,
studentName varchar(10),
gender char(1),
age int,
birthDate date,
teacherId int,
PRIMARY KEY(studentId),
FOREIGN KEY (teacherId) REFERENCES Teacher(teacherId));
CREATE TABLE course (courseId int,
courseName varchar(30),
teacherId int,
PRIMARY KEY (courseId),
FOREIGN KEY (teacherId) REFERENCES Teacher(teacherId));
CREATE TABLE courseSelection (courseSelectionId int,
studentId int,
courseId int,
PRIMARY KEY(courseSelectionId),
FOREIGN KEY (studentId) REFERENCES Student(studentId),
FOREIGN KEY (courseId) REFERENCES Course(courseId));


Based on the database schema described above, express the following natural language queries in SQL.


1. Find all courses (courseId,courseName, teacherName) that ‘Michael Smith’ has selected. 12%


2. Find the course (courseId,courseName) teached by ‘Mike’ and ‘Michael Smith’ selected. 12%


3. Find all courses (courseId,courseName) that ‘Michael Smith’ has not selected . 12%


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Java软件开发 求职 下一篇介绍一下javax.servlet.Servlet接..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: