Write SQL statements to create at the two tables for the database. The tables must have at least three relevant columns with appropriate types, a primary key and at least one table should have a foreign key and the related foreign key constraints. CREATE TABLE students ( Student_id int NOT NULL PRIMARY KEY, Stud_firstname VARCHAR(30) NOT NULL, Stud_lastname VARCHAR(30) NOT NULL, Stud_email VARCHAR(80) NOT NULL UNIQUE advisor_id int, );
Write SQL statements to create at the two tables for the
CREATE TABLE students (
Student_id int NOT NULL PRIMARY KEY,
Stud_firstname VARCHAR(30) NOT NULL,
Stud_lastname VARCHAR(30) NOT NULL,
Stud_email VARCHAR(80) NOT NULL UNIQUE
advisor_id int,
);
create table advisor (
advisor_id int not null primary key,
stud_id int,
adv_firstname varchar(30),
adv_lastname varchar(30),
foreign key(student_id) references students(student_id)
);
[keep getting error, need help correcting]
Given:
We have to discuss SQL statements to create at the two tables for the database. The tables must have at least three relevant columns with appropriate types, a primary key and at least one table should have a foreign key and the related foreign key constraints.
Step by step
Solved in 2 steps