TABLES; SHOW
Tables_in_yelp |
---|
businesses |
reviews |
users |
your name goes here
Invalid Date
Today’s lab will provide practice working with SQL clauses in DBeaver. Don’t forget the importance of the order of the SQL clauses.
The goals for lab 3 include:
SELECT
, FROM
, WHERE
, GROUP BY
, HAVING
, ORDER BY
, and LIMIT
.JOIN
ing tablesBe sure to indicate (in the .sql file) which problem is being answered with which SQL code. Use the following syntax to comment within a .sql file: /* here is where comments go */
. Indeed, feel free to copy the question into the .sql file so that you have it for your own records.
save the .Rproj file somewhere you can find it. Don’t keep everything in your downloads folder. Maybe make a folder called SDS261
or something. That folder could live on your Desktop. Or maybe in your Dropbox.
The SQL document should be saved in the R Project as lab3-sds261-yourlastname-yourfirstname.sql
. You will have to navigate to the R Project to save the DBeaver file in the correct place.
Connect to the yelp
database, which contains the businesses
, reviews
, and users
tables. See README file for connection details.
yelp
database, identify the number of records and the variables. (That means, write at least a sentence for each table.)LIMIT
to start, just in case there are hundreds of cities. Write down a few of the city names. Do you notice anything interesting?users
with the reviews
using a JOIN
. How many records are there? What does that tell you about the two tables?reviews
table but do not exist in the users
table. Hint: use a RIGHT JOIN
to keep all the reviews, and then look for the rows where the user_id
from the users
table IS NULL
.