Open v4run3 opened 4 weeks ago
There is no problem in both spellings.
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
; USElinkedin
;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
) );