You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE TABLE Users( id INT AUTO_INCREMENT, first_lastname VARCHAR(30) NOT NULL, username VARCHAR(25) NOT NULL, password VARCHAR(128) NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE Schools ( id INT AUTO_INCREMENT, school_name VARCHAR(50) NOT NULL, school_type ENUM('Primary', 'Secondary', 'Higher Education') NOT NULL, school_location VARCHAR(32) NOT NULL, school_year DATE NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE Companies( id INT AUTO_INCREMENT, company_name VARCHAR(30) NOT NULL, company_industry VARCHAR(20) NOT NULL, company_locationVARCHAR(20) NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE people_connections( id INT AUTO_INCREMENT, user_id INT NOT NULL, following_user_id INT NOT NULL, connection_date DATE NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(user_id) REFERENCES Users(id),
FOREIGN KEY(following_user_id) REFERENCES Users(id)
);
CREATE TABLE school_connections( id INT AUTO_INCREMENT, user_id INT NOT NULL, school_id INT NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, degree_type VARCHAR(10) NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(user_id) REFERENCES Users(id),
FOREIGN KEY(school_id) REFERENCES Schools(id)
);
CREATE TABLE company_connections( id INT AUTO_INCREMENT, user_id INT NOT NULL, company_id INT NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(user_id) REFERENCES Users(id),
FOREIGN KEY(company_id) REFERENCES Companies(id)
);
The text was updated successfully, but these errors were encountered:
v4run3
changed the title
Corrected Version of schema.sql
Week 6 (Scaling)/ Happy To Connect
Oct 24, 2024
In the school_type u have used: school_type ENUM(Primary, Secondary, Higher Education) NOT NULL, (which will give you error since you are using `` inside the ENUM)
instead you should be using '' to pass the data inside the ENUM.
Hello again, I tried both codes and the tables were created without any problems, although there were 1-2 errors due to SQLite3. Not only does the school desk you mentioned not appear, but it also doesn't appear when I try your code. This is probably a bug caused by the enum code and sqlite3. Also, when I try the code you sent with .read, both the Companies table and the school table do not appear in the schema and tables sections.
CREATE DATABASE
linkedin
;USE
linkedin
;CREATE TABLE
Users
(id
INT AUTO_INCREMENT,first_lastname
VARCHAR(30) NOT NULL,username
VARCHAR(25) NOT NULL,password
VARCHAR(128) NOT NULL,PRIMARY KEY(
id
));
CREATE TABLE
Schools
(id
INT AUTO_INCREMENT,school_name
VARCHAR(50) NOT NULL,school_type
ENUM('Primary', 'Secondary', 'Higher Education') NOT NULL,school_location
VARCHAR(32) NOT NULL,school_year
DATE NOT NULL,PRIMARY KEY(
id
));
CREATE TABLE
Companies
(id
INT AUTO_INCREMENT,company_name
VARCHAR(30) NOT NULL,company_industry
VARCHAR(20) NOT NULL,company_location
VARCHAR(20) NOT NULL,PRIMARY KEY(
id
));
CREATE TABLE
people_connections
(id
INT AUTO_INCREMENT,user_id
INT NOT NULL,following_user_id
INT NOT NULL,connection_date
DATE NOT NULL,PRIMARY KEY(
id
),FOREIGN KEY(
user_id
) REFERENCESUsers
(id
),FOREIGN KEY(
following_user_id
) REFERENCESUsers
(id
));
CREATE TABLE
school_connections
(id
INT AUTO_INCREMENT,user_id
INT NOT NULL,school_id
INT NOT NULL,start_date
DATE NOT NULL,end_date
DATE NOT NULL,degree_type
VARCHAR(10) NOT NULL,PRIMARY KEY(
id
),FOREIGN KEY(
user_id
) REFERENCESUsers
(id
),FOREIGN KEY(
school_id
) REFERENCESSchools
(id
));
CREATE TABLE
company_connections
(id
INT AUTO_INCREMENT,user_id
INT NOT NULL,company_id
INT NOT NULL,start_date
DATE NOT NULL,end_date
DATE NOT NULL,PRIMARY KEY(
id
),FOREIGN KEY(
user_id
) REFERENCESUsers
(id
),FOREIGN KEY(
company_id
) REFERENCESCompanies
(id
));
The text was updated successfully, but these errors were encountered: