SQL Suppose that we have a table of positive integers up to 100, as in lecture:
ID: 3827658 • Letter: S
Question
SQL
Suppose that we have a table of positive integers up to 100, as in lecture:
Question: Define a table divisors in which each row describes the number of unique divisors for an integer up to 100. For example, the number 16 has 5 unique divisors: 1, 2, 4, 8, and 16.
create table divisors as select "REPLACE THIS LINE WITH YOUR SOLUTION";
Here's an (incomplete) example of what the divisors table should look like. : - Example: select * from divisors limit 20; -- Expected output: -- 1|1 -- 2|2 -- 3|2 -- 4|3 -- 5|2 -- 6|4 -- 7|2 -- 8|4 -- 9|3 -- 10|4 -- 11|2 -- 12|6 -- 13|2 -- 14|4 -- 15|4 -- 16|5 -- 17|2 -- 18|6 -- 19|2 -- 20|6
Explanation / Answer
CREATE TABLE DIVISORS AS SELECT A.INTE,COUNT(DISTINCT B.INTE) AS 'TOTAL_DIV' FROM INTEGER_TAB A INNER JOIN INTEGER_TAB B ON B.INTERelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.