students(student_id, name, year, GPA, programs_code) instructors(instructor_id, name, title, salary, programs_code) programs(code, name, division, instructor_id) course(course_name, credit, domain, course_number) enroll(student_id, instructor_id, course_name) 1. Create tables according to the schema.
时间: 2024-02-27 08:54:56 浏览: 63
Sure, here are the SQL statements to create the tables based on the given schema:
```
CREATE TABLE students (
student_id INT PRIMARY KEY,
name VARCHAR(50),
year INT,
GPA DECIMAL(3,2),
programs_code VARCHAR(10)
);
CREATE TABLE instructors (
instructor_id INT PRIMARY KEY,
name VARCHAR(50),
title VARCHAR(50),
salary DECIMAL(10,2),
programs_code VARCHAR(10)
);
CREATE TABLE programs (
code VARCHAR(10) PRIMARY KEY,
name VARCHAR(50),
division VARCHAR(50),
instructor_id INT,
FOREIGN KEY (instructor_id) REFERENCES instructors(instructor_id)
);
CREATE TABLE course (
course_name VARCHAR(50) PRIMARY KEY,
credit INT,
domain VARCHAR(50),
course_number INT
);
CREATE TABLE enroll (
student_id INT,
instructor_id INT,
course_name VARCHAR(50),
FOREIGN KEY (student_id) REFERENCES students(student_id),
FOREIGN KEY (instructor_id) REFERENCES instructors(instructor_id),
FOREIGN KEY (course_name) REFERENCES course(course_name)
);
```
Please note that I assumed some data types for the columns, but you may need to adjust them based on your specific requirements.
阅读全文