%sql
-- Create the database if it doesn't exist
CREATE DATABASE IF NOT EXISTS teamsA;
-- Use the database
USE teamsA;
-- Create the table
CREATE TABLE IF NOT EXISTS Ateam (
First_Name VARCHAR(50),
Last_Name VARCHAR(50),
Age INT,
Residential_Area VARCHAR(100)
);
-- Insert some sample data
INSERT INTO Ateam VALUES
('George', 'Mouxios', 27, '40 Ekklisies'),
('Konstantinos', 'Ntellas', 29, 'Toumpa'),
('Persa', 'Antoniou', 27, 'Euosmos'),
('Vasiliki', 'Tranterou', 25, 'Ano Poli'),
('Ilona', 'Baimpouridou', 28, 'Kalamaria');
-- Create the partitioned table
CREATE TABLE IF NOT EXISTS team_partitioned (
First_Name VARCHAR(50),
Last_Name VARCHAR(50),
Age INT,
Residential_Area VARCHAR(100)
)
PARTITIONED BY (Age);
-- Populate the partitioned table with data
INSERT INTO TABLE team_partitioned
SELECT First_Name, Last_Name,Age, Residential_Area FROM Ateam;
-- Show the data in the partitioned table
SELECT * FROM team_partitioned;