Querying Baseball data off platform project

Hello Coders,
I am new to the forum. I am glad to learn in this website. I learnt a lot. I woould love to find buddies who are available to discuss DATASCIENCE PATH.
I am working on Design Databases With PostgreSQL skillpath and I am getting an error with Baseball dataset .sql file. I tried to import the file in pgadmin4, but the .sql file is throwing errors.
Anybody have already resolved this? Maybe Codecademy Admins/Tutors could help me with this???

2 Likes

Hey man! could you link us to the exercise you are referring to?
What error is the .sql file throwing?

Hi, welcome to the forums!
Is it this?

https://www.codecademy.com/paths/design-databases-with-postgresql/tracks/what-can-i-do-with-a-database/modules/querying-baseball-data-off-platform-project/informationals/off-platform-project-baseball-through-the-years

Hi lisalisaj,
Thankyou, Nice meeting you.
Exactly, this is the project I was referring to.

Hey lucasvinzon,
https://www.codecademy.com/paths/design-databases-with-postgresql/tracks/what-can-i-do-with-a-database/modules/querying-baseball-data-off-platform-project/informationals/off-platform-project-baseball-through-the-years
this is the link. I am getting error on line 688.

Could you copy the entire error and paste here?

Here you go

1 Like

What is the 1 referring to? is it the id? it’s a syntax error, so maybe it’s expecting something else? a break?

According to the info they provided as below, the baseball_database.sql file should run and populate the tables. Yes it is syntax error, but inorder to correct this, I do not know how they wanted to design the database.

Step 1 — Downloading The Data
In the files that you downloaded to begin this project, you will find a file called baseball_database.sql. In
your PostgreSQL client, create a new database (we named ours baseball), and then open this .sql file. This
should run all of the PostgreSQL commands to completely set up your tables and populate the tables with the
data.

And where is the line of code you have written? Maybe it’s an issue with how you are importing it! Have in mind that when you are asking for some help, it’s best practice to help the other person to figure out things.
Besides that, I would say, open the SQL file, compare line 688 with 687 and 689 and check if there’s some minor difference with how Line 688 is being presented and manually fix it. I’d like to check that out as well! I just don’t have access to it…

1 Like

I haven’t done this module yet (I am VERY happy to see baseball data though!). I have postgresql & pgadmin on my machine already (from a previous number of projects), I just need to connect to that db (and read the instructions).
I’m going to work on trying to replicate the issue and will report back. :slight_smile:

3 Likes

It is highly disppointing to get such replies. I gave you the link which has all the information about this project. Have in mind that it is best practice to read the link provided by the other person.

Where is it written that I have to write a line of code. It is given in the project instructions, to import the sql file through the menu in postbird / postgres client and execute that sql file.

The problem occurs while execution.

2 Likes

I appreciate your response @lisalisaj, it would be helpful that if other users are also getting the same issue,
HelpDesk people will respond promptly otherwise he is not reading the project instructions(which you have read and understood the problem and you are trying at your end if you could replicate the issue or not, I appreciate it ), but preaching best practices which he himself is not following.

1 Like

Please be aware that the ppl who respond to queries here in the Forums are either volunteers and/or other learners on the CC platform that come here to attempt to help other learners out. We are not perfect; we make mistakes too. :slight_smile:

There are guidelines for asking a great question:

And in order to receive a response, other ppl need as much information as possible to understand and/or replicate the issue. Most times, that involves posting your code + an explanation of what you did to receive the error message.

5 Likes

Can you open the file in a text editor?
I just did that and found the particular line number where it’s throwing an error (I’m not sure why tho):

Hi Lisa,
Thankyou for your effort, I already posted a screenshot and the line number where the error occurs.
I can try to fix it but I do not know why they wanted to copy a table again and that there are 29 tables, I am not sure why they wrote some code and how they wanted to design the database

I don’t know if this matters, but, there are two columns w/team id:

teamid text,
    team_id bigint,

But, if you look at the readme.txt file, that second team_id col doesn’t exist.

I’m a baseball fan and have looked at baseball data and I don’t know what that 2nd team_id is even referring to. :baseball:

1 Like

Maybe re-download the tables and see if that fixes the issue.

Hey man, I’m very sorry that I came out as rude. As I said, when referring to the course:

I’d like to check that out as well! I just don’t have access to it…

I don’t have Codecademy PRO, that’s why I couldn’t check your link and had to ask for the rest of your code. Sorry for not being clearer.

3 Likes

Hi all!

I was having the same issue, but I solved the problem with some command line prompts:

  1. Navigate to the folder with baseball_database.sql in the command line.
  2. Run psql -d <your-baseball-database-name> -f baseball_database.sql.

And that’s it! Now I can see all of the newly created tables without any problem in my client.

This webpage helped me solve the problem.

P.S., I’m running macOS Catalina 10.15.7 and using PostgreSQL (v. 13.0) and pgAdmin 4 (v. 4.27).

28 Likes