-- Create the Country Table where:
-- ID – Primary Key, Auto Increment, Integer ranging from 0 to 255
-- CountryName – Variable-length string with max 100 characters
-- Continent – Variable-length string with max 50 characters; must be one of:
-- 'Africa', 'Asia', 'Europe', 'North America', 'South America', 'Oceania', 'Antarctica'
-- PopulationMillions – Decimal number with 5 digits total and 1 decimal place; must be between 0.1 and 9999.9
-- IndependenceDate Date must be on or after Jan 1, 1800
CREATE TABLE Country (
ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
CountryName VARCHAR(100),
Continent VARCHAR(50),
CHECK(Continent IN (
'Africa',
'Asia',
'Europe',
'North America',
'South America',
'Oceania',
'Antarctica'
)),
PopulationMillions DECIMAL(5,1),
CHECK (PopulationMillions BETWEEN 0.1 AND 9999.9),
IndependenceDate DATE
CHECK (IndependenceDate >= '1800-01-01')
);
INSERT INTO Country(ID, CountryName, Continent, PopulationMillions, IndependenceDate) VALUES
(1, 'Canada', 'North America', NULL, '1867-07-01'),
(2, 'Brazil', 'South America', 214.3, '1822-09-07'),
(3, 'Germany', 'Europe', 83.2, '1871-01-18');
To embed this project on your website, copy the following code and paste it into your website's HTML: