I have two SQL questions 1 How many people follow Joey 2 How

I have two SQL questions.

1: How many people follow Joey?

2: How many people does Joey follow?

Attached are images that can help you solve this.

sql DROP TABLE IF EXISTS users; DROP TABLE IF EXISTS follows; CREATE TABLE users NOT NULL, USERID INT NAME VARCHAR 256) NOT NULL, YEAR FLOAT NOT NULL, PRIMARY KEY (USERID) CREATE TABLE follows NOT NULL, USERID INT NOT NULL, FOLLOWID INT PRIMARY KEY USERID FOLLOWID) Done. Done. Done. Done. capture count 0 users Ian Daniel \"Sarah \"Kelly Sam \"Alison\", \"Henry\", \"Joey\", \"Mark\", \"Joyce\", \"Natalie\", \"John\" years [1, 3, 4, 3, 4, 2, 5, 2, 1, 3, 4, 21 for username 1 year in zip (users years count sql INSERT INTO users VALUES Count $username year

Solution

1)

select count(*)

where FOLLOWID = (select USERID

from users

where u.NAME = \"Joey\")

2)

select count(*)

where USERID = (select USERID

from users

where u.NAME = \"Joey\")

I have two SQL questions. 1: How many people follow Joey? 2: How many people does Joey follow? Attached are images that can help you solve this. sql DROP TABLE

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site