Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week 6 (Scaling)/ Happy To Connect #1

Open
v4run3 opened this issue Oct 24, 2024 · 3 comments
Open

Week 6 (Scaling)/ Happy To Connect #1

v4run3 opened this issue Oct 24, 2024 · 3 comments

Comments

@v4run3
Copy link

v4run3 commented Oct 24, 2024

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_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)
);

@v4run3 v4run3 changed the title Corrected Version of schema.sql Week 6 (Scaling)/ Happy To Connect Oct 24, 2024
@muhammedahmetsekerci
Copy link
Owner

There is no problem in both spellings.

@v4run3
Copy link
Author

v4run3 commented Oct 29, 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.

@muhammedahmetsekerci
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants