Create a MySQL table named 'prime_test' that contains two columns. The first column is an integer named 'number' that is the primary key and cannot be NULL. The second column is a variable length string named 'is_prime' with a maximum length of 50. Write one or more insert statements that fills only the 'number' column of table 'prime_test' with the integers between 2 and 100. Write one or more update statements that sets the 'is_prime' column for each associated integer. For a prime, the column should read 'prime'. For non-primes, the column should read 'composite'. Write a final select statement to return only the 'number' column from 'prime_test' for records that are prime, ordered from largest to smallest.
I need SQL code for the following question: - Use MYSQL for coding
Create a MySQL table named 'prime_test' that contains two columns. The first column is an integer named 'number' that is the primary key and cannot be NULL. The second column is a variable length string named 'is_prime' with a maximum length of 50.
Write one or more insert statements that fills only the 'number' column of table 'prime_test' with the integers between 2 and 100.
Write one or more update statements that sets the 'is_prime' column for each associated integer. For a prime, the column should read 'prime'. For non-primes, the column should read 'composite'.
Write a final select statement to return only the 'number' column from 'prime_test' for records that are prime, ordered from largest to smallest.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps