0

Quick Question for yall, so I set .nullvalue to "NULL" before writing my table updates. Second question, how do I rearrange columns in my final meteorites table that was it passes the CS50 Check50 and I am unsure why nametype is not included in the final table. This is what I posted on reddit asking for help... Thanks for the critiques! HI, I am having an issue with my table saying I don't have the correct columns, does anyone know what the final table columns need to be included and in a specific order different than that of the meteorites.csv import?

Below is the schema I created,

I am unsure if nametype is included in the final table, or where my error is coming from.

CREATE TABLE IF NOT EXISTS meteorites_temp ( name TEXT NOT NULL, id INTEGER, nametype TEXT NOT NULL, class TEXT NOT NULL, mass REAL, discovery TEXT, year YEAR, lat REAL, long REAL ); CREATE TABLE IF NOT EXISTS meteorites ( name TEXT NOT NULL, id INTEGER, nametype TEXT NOT NULL, class TEXT NOT NULL, mass REAL, discovery TEXT, year YEAR, lat REAL, long REAL, PRIMARY KEY (id) ); my cleaned meteorites_temp, has columns name, id, nametype, class, mass, discovery, year, lat, long

with the first row looking like,

Aachen, 1, Valid, L5, 21.0, Fell, 1880, 50.78, 6.08.

INSERT INTO meteorites_ordered (name, id, nametype, class, mass, discovery, year, lat, long)

SELECT (name, id, nametype, class, mass, discovery, year, lat, long)

FROM meteorites_temp

WHERE year = year ORDER BY name asc;

1 Answer 1

0

The Specification is very specific and specifies Columns in the meteorites table are:

  • id, which represents the unique ID of the meteorite.
  • name, which represents the given name of the meteorite.
  • class, which is the classification of the meteorite, according to the traditional classification scheme.
  • mass, which is the weight of the meteorite, in grams.
  • discovery, which is either “Fell” or “Found”. “Fell” indicates the meteorite was seen falling to Earth, whereas “Found” indicates the meteorite was found only after landing on Earth.
  • year, which is the year in which the the meteorite was discovered.
  • lat, which is the latitude at which the meteorite landed.
  • long, which is the longitude at which the meteorite landed.

It's safe to assume they should be in that order.

3
  • Thank you DinoCoder! So how do I go about moving the columns in my final table. I tried to used Alter table and add a primary key after I created my final table but that didn't work. Thanks! Do I need to use .nullvalue and null?
    – adubzzzz
    Commented Oct 17, 2023 at 1:18
  • You need to create the meteorites table as specified and do the insert/select appropriately. You should not need .nullvalue. Commented Oct 17, 2023 at 2:02
  • Just remove nametyp in your final table
    – Mikkey200
    Commented Oct 17, 2023 at 4:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .