Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*All information from:
- https://en.wikipedia.org/wiki/List_of_largest_stars */
- CREATE TABLE Stars(
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- starName TEXT,
- temp INTEGER,
- solar_radius INTEGER,
- distance INTEGER
- );
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('UY Scuti', 3365, 1708, 9500);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('NML Cygni', 3250, 2775, 1610);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('WOH G64', 3400, 1540, 163000);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('RW Cephei', 4015, 1535, 3500);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('Westerlund 1-26', 3600, 1530, 11500);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('V354 Cephei', 3650, 1520, 9000);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('VX Sagittarii', 3575, 1520, 5.15);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('VY Canis Majoris', 3490, 1420, 3840);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('KY Cygni', 3500, 1420, 5000);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('AH Scorpii', 3682, 1411, 7400);
- INSERT INTO Stars(starName, temp, solar_radius, distance) VALUES ('HR 5171 A', 5000, 1316, 11700);
- SELECT starName AS "Name by Solar Radius (H-L)", temp AS "Temperature (Kelvins)", solar_radius AS "Solar Radius (1 = 695,700kl)", Distance AS "Distance (Lightyears)" FROM Stars
- ORDER BY solar_radius DESC;
- SELECT starName AS "Name by Distance (H-L)", temp AS "Temperature (Kelvins)", solar_radius AS "Solar Radius (1 = 695,700kl)", distance AS "Distance (Lighyears)" FROM Stars
- ORDER BY distance DESC;
- SELECT starName AS "Name by Temperature (H-L)", temp AS "Temperature (Kelvins)", solar_radius AS "Solar Radius (1 = 695,700kl)", distance AS "Distance (Lighyears)" FROM Stars
- ORDER BY temp DESC;
- SELECT AVG(solar_radius) AS "Average Radius" FROM Stars;
- SELECT COUNT(*) AS "Number of stars",
- CASE
- WHEN solar_radius > 1608 THEN "Stars ABOVE average solar radius"
- ELSE "Stars BELOW average solar radius"
- END AS Description
- FROM Stars
- GROUP BY Description;
- SELECT starName AS "Star Name",
- CASE
- WHEN solar_radius >= 1608 THEN "ABOVE average solar radius"
- ELSE "BELOW average solar radius"
- END AS Description
- FROM Stars;
- SELECT AVG(temp) AS "Average Temperature" FROM Stars;
- SELECT COUNT(*) AS "Number of stars",
- CASE
- WHEN temp > 3684.2 THEN "stars ABOVE average temperature"
- ELSE "stars BELOW average temperature"
- END AS Description
- FROM Stars
- GROUP BY Description;
- SELECT starName AS "Star Name",
- CASE
- WHEN temp > 3684.2 THEN "is ABOVE average temperature"
- ELSE "is BELOW average temperature"
- END AS Description
- FROM Stars;
- SELECT AVG(distance) AS "Average Distance" FROM Stars;
- SELECT COUNT(*) AS "Number of stars",
- CASE
- WHEN distance > 20550.4 THEN "stars ABOVE average distance"
- ELSE "stars BELOW average distance"
- END AS Description
- FROM Stars
- GROUP BY Description;
- SELECT starName AS "Star Name",
- CASE
- WHEN distance > 20550.4 THEN "is ABOVE average distance"
- ELSE "is BELOW average distance"
- END AS Description
- FROM Stars;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement