2021 fall cs61a lab13
作者:互联网
网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/lab/lab13/
.read data.sql
CREATE TABLE bluedog AS
SELECT color, pet FROM students WHERE color = 'blue' AND pet = 'dog';
CREATE TABLE bluedog_songs AS
SELECT color, pet, song FROM students WHERE color = 'blue' AND pet = 'dog';
CREATE TABLE smallest_int_having AS
SELECT time, smallest FROM students group by smallest HAVING COUNT(*) = 1;
CREATE TABLE matchmaker AS
SELECT s1.pet, s1.song, s1.color, s2.color
FROM students as s1, students as s2
WHERE s1.pet = s2.pet and s1.song = s2.song and s1.time < s2.time;
CREATE TABLE sevens AS
SELECT s.seven
FROM students AS s, numbers AS n
WHERE s.time = n.time and s.number = 7 and n.'7' = "True";
CREATE TABLE avg_difference AS
SELECT round(avg(abs(number - smallest)))
FROM students;
标签:pet,s1,SELECT,cs61a,students,lab13,2021,CREATE,color 来源: https://www.cnblogs.com/echoT/p/16214731.html