Practice these queries to sharpen your SQL skills. If you get stuck, take help from Google or other resources.
users
TableCREATE TABLE users (
id SERIAL PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
age INT,
country VARCHAR(50),
email VARCHAR(100)
);
INSERT INTO users (first_name, last_name, age, country, email) VALUES
('Arif', 'Hossain', 25, 'Bangladesh', '[email protected]'),
('Sara', 'Khan', 30, 'India', '[email protected]'),
('Rafi', 'Ahmed', 22, 'Pakistan', '[email protected]'),
('Nusrat', 'Akter', 28, 'Nepal', '[email protected]'),
('Tanvir', 'Rahman', 35, 'Sri Lanka', '[email protected]'),
('Mina', 'Begum', 20, 'Maldives', '[email protected]'),
('Fahim', 'Chowdhury', 40, 'Bhutan', '[email protected]'),
('Rumana', 'Sultana', 27, 'Afghanistan','[email protected]'),
('Jahid', 'Islam', 24, 'Bangladesh', '[email protected]'),
('Tania', 'Sultana', 29, 'Nepal', '[email protected]');
Let’s say some users don’t have an email yet:
INSERT INTO users (first_name, last_name, age, country, email) VALUES
('Imran', 'Haque', 26, 'Bangladesh', NULL),
('Lina', 'Begum', 23, 'India', NULL);