Hi, I need to find the percent of passengers survived? (total). How do you do
it? I tried the comment below but it did not work.
SELECT
SUM(CASE WHEN survived=1 THEN 1.0 ELSE 0.0 END) /
CAST(COUNT(*) AS FLOAT)*100
AS tot_pct_survived
FROM passengers;
This is the table;
CREATE TABLE passengers (
id INTEGER NOT NULL,
lname TEXT,
title TEXT,
class TEXT,
age FLOAT,
sex TEXT,
survived INTEGER,
code INTEGER
);
--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users