Good morning, the challenge is asking me to add a column to the second table which already exists so i tried using the ALTER TABLE second_table DROP COLUMN first_column; command and it didnt register so should i reset the whole lesson back to challenge 1 or did i make a wrong turn somewhere else?
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54
Challenge: Learn Relational Databases by Building a Mario Database - Build a Mario Database
Link to the challenge:
you can try to reset the step only by clicking the reset button in the middle of the page (just above the terminal area)
Yeah i already tried that as well
if the table still has something (a column you said?) that shouldn’t be there, then I would drop that column.
Then I would reset again.
Then I would click the get Hint until it showed me the exact command.
Then I would try that exact command.
Tried that too, im gonna have to see if theres another way to drop a column other than ALTER TABLE second_table DROP COLUMN first_column; cause that seems to not be dropping the column so i can create it again
that is the correct statement.
Why do you say it doesn’t work?
(did you try to run \d to confirm the table columns after?)
I entered the drop column code and it shows me this when i \d
List of relations
±-------±-------------±------±-------------+
| Schema | Name | Type | Owner |
±-------±-------------±------±-------------+
| public | second_table | table | freecodecamp |
±-------±-------------±------±-------------+
(1 row)
you need to use \d second_table
if you want to see that specific table’s columns
Table "public.second_table"
±-------------±--------±----------±---------±--------+
| Column | Type | Collation | Nullable | Default |
±-------------±--------±----------±---------±--------+
| first_column | integer | | | |
±-------------±--------±----------±---------±--------+
Ok so i got the column to drop then i hit reset and tried entering the create column again, its still not registering that theres a column named first_column there. i keep getting this message “FATAL: terminating connection due to administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.” after resetting should i just wait until sometime later in the day and try again?
yeah that’s probably something you cannot do anything about.
One other thing I noticed, is that your screenshot showed that you were running the commands without first connecting to the database. So always make sure you run the connect command first.
If codeally is working and you can get into the postgres terminal and connect to the db then you should be able to continue
dang it, thats true i forgot the \c postgres command on my way back. Ok let me fix a few things. Thank you hbar1st
1 Like