Question
To summarize the link above, sqlite3 databases ( unless marked STRICT ) can store any datatype in any column, regardless of the column's datatype. For
To summarize the link above, sqlite3 databases ( unless marked STRICT ) can store any datatype in any column, regardless of the column's datatype.
For example, if you
CREATE TABLE student(
name TEXT
);
You can still
INSERT INTO student VALUES (1);
You would think that this would generate an error because 1 is not TEXT, but sqlite3 is flexible with datatypes ( unlike other databases ).
Create a table with 5 columns "column1", "column2",..., "column5", each of a different type. Then insert 10 rows and be sure to insert the wrong datatype for every.single.column. Then run the command
SELECT typeof(column1), typeof(column2), typeof(column3), typeof(column4), typeof(column5) FROM your_table;
The output should match the types you inserted, not the type of the column.
Hopefully you find this interesting!
PART 2:
How does the type flexibility affect joins?
Do the joins require columns to have the same type?
Create two tables, one with an INT PRIMARY KEY and the other with a TEXT FOREIGN KEY.
Add one row into each table such that you can inner join them.
Perform the inner join.
If it is not possible to do this, tell me why.
I'm not sure if this is possible, so we'll learn together!
My guess: should be possible.
Submit
* two .sql files called part1.sql and part2.sql ( or something similar) with the commands you ran
* a selfie with the output of your typeof() query from part 1.
* a selfie with the output of part2 if it is possible to perform the join.
50 points for doing each part
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started