Tell us what’s happening:
Describe your issue in detail here.
I Cannot Complete the 2nd table (star as illustrated in this Video - Celestial Bodies Database | FreeCodeCamp - YouTube) (the video is just to make the specalist understand which approach I Am taking, I Challenge if similar Question has posted on the forum for freeCodeCamp family!!!)
The third attempt always Goes wrong & this is a manipulative EXAM
Your code so far
CREATE TABLE star(star_id PRIMARY SERIAL KEY NOT NULL, radius INT NOT NULL, color VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, CONSTRAINT fk_galaxy FOREIGN KEY(galaxy_id) REFERNCES galaxy(galaxy_id));
CREATE TABLE star(star_id SERIAL PRIMARY KEY NOT NULL, radius INT NOT NULL, color VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, CONSTRAINT fk_galaxy FOREIGN KEY(galaxy_id) REFERNCES galaxy(galaxy_id));
bash: syntax error near unexpected token `('
CREATE TABLE star(SERIAL PRIMARY KEY NOT NULL, radius INT NOT NULL, color VARCHAR(255) NOT NULL, galaxy_id INT, name VARCHAR(255), CONSTRAINT fk_galaxy FOREIGN KEY(galaxy_id) REFERNCES galaxy(galaxy_id));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Challenge: Celestial Bodies Database - Build a Celestial Bodies Database
The Error code : bash: syntax error near unexpected token `(’
CREATE TABLE star(SERIAL PRIMARY KEY NOT NULL, radius INT NOT NULL, color VARCHAR(255) NOT NULL, galaxy_id INT, name VARCHAR(255), CONSTRAINT fk_galaxy FOREIGN KEY(galaxy_id) REFERENCES galaxy(galaxy_id));
the final code is but the termnianl is not accepting I Challenge u to find an error CREATE TABLE star(star_id SERIAL PRIMARY KEY NOT NULL, radius INT NOT NULL, color VARCHAR(255) NOT NULL, galaxy_id INT, name VARCHAR(255), CONSTRAINT fk_galaxy FOREIGN KEY(galaxy_id) REFERENCES galaxy(galaxy_id))
I just copy/pasted this command into the project and it worked perfectly for me.
Obviously I had to add ‘CREATE TABLE’ before and add a semicolon after.
I Tried the same Code how to view saved database as I Closed the account so it starts with codeally@5be1ed8b08bd:~/project$ instread of the Post gress!!!
If you want to save your database before exiting, you can create a dump into an sql file, which can then be used to rebuild the database when you go back to the course next time.
Enter this command into a bash terminal (not the psql one):
I’m sure that the first command will save an sql dump of your database into a file called universe.sql and that the second command will rebuild that database again, if you enter the commands into a bash terminal.