CREATE TABLE students (
    id INT PRIMARY KEY,
    name VARCHAR(100),
    age INT,
    absences INT
);

INSERT INTO students (id, name, age, absences) VALUES
(1, 'Angelina', 20, 5),
(2, 'Sasha', 22, 10),
(3, 'Timur', 21, 8),
(4, 'Maksim', 23, 3),
(5, 'Anna', 20, 15);

SELECT * FROM students;
UPDATE students SET age = FLOOR(RAND() * 10) + 20;

UPDATE students SET absences = FLOOR(RAND() * 20);

SELECT AVG(absences) AS average_absences FROM students;

SELECT * FROM students WHERE absences = (SELECT MAX(absences) FROM students);

SELECT * FROM students WHERE absences < (0.5 * (SELECT MAX(absences) FROM students));

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: