Find Active Interns
UptoSkills Arena is organizing an internship program. The interns table contains information about all the interns, including their name and whether they are currently active.
interns(intern_id INTEGER, name VARCHAR(50) NOT NULL, active BOOLEAN NOT NULL)
Return the name of all active interns. The order of names does not matter. NULL names are not possible due to the NOT NULL constraint. An empty result is possible if no interns are active.
Tables
CREATE TABLE interns ( intern_id integer PRIMARY KEY, name varchar(50) NOT NULL, active boolean NOT NULL );
Example data
INSERT INTO interns (intern_id, name, active) VALUES (1, 'Alice', TRUE), (2, 'Bob', FALSE), (3, 'Charlie', TRUE), (4, 'David', FALSE), (5, 'Eve', TRUE);
Your query is also checked on hidden datasets with different data.
Hints
Similar problems
- Find Products Below a Certain PriceEasy
- Find Customers Who Placed Orders Above a Certain AmountEasy
- Find Students from a Specific CollegeEasy
- Find Students with Scores Above 80Easy
- Find High-Scoring Students in PythonEasy
- Total Salary Expenditure by DepartmentEasy
More in: SQL and Databases problems
-- Select the names of active interns
SELECT name
FROM interns
Your query runs on the example tables shown with the problem, then on hidden datasets when you submit.
Write standard SQL. MySQL habits work too: IFNULL, IF, YEAR(), DATE_FORMAT, GROUP_CONCAT, `backticks` and LIMIT 5, 10. It runs on PostgreSQL, so integer division keeps whole numbers (5 / 2 = 2): write 5.0 / 2 for 2.5.