During INSERT INTO example, I got curioused whether as to the parameter should match the column order of the table or simply call out existing columns in the table.
But then, I realized, inserting a value with a different type doesn’t seem to complain anything and the query result certainly has the new data.
Wonder how this is ok. Seems to defeat the purpose of delcaring data type.
CREATE TABLE celebs ( id INTEGER, name TEXT, age INTEGER ); -- Example from the course INSERT INTO celebs (id, name, age) VALUES (1,'TESTING',2); -- Wanted to see if the parameter has to be in the order the table column is -- Seems like the answer is no, just need to call out column names INSERT INTO celebs (name, id, age) VALUES ('TESTING2',3,4); INSERT INTO celebs (name, id, age) VALUES (5, 'TESTING3', 6); SELECT * FROM celebs;
Query Results id name age 1 TESTING 2 3 TESTING2 4 TESTING3 5 6
INT in STR may be ok (automatically typecast int to str?)
But not sure how STR gets saved as INT.