You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
Title: DogGroomerSQL
Type: Homework
Created By: Hunter Wallen
Setup
- Create a new database called
DogGroomer, connect to it, and run the following code (given to you in theschema.sqlfile inside of thegroomer_seed_datadirectory):- Note: You can run this .sql file using
psql <db_name> -f <path_to_file>
- Note: You can run this .sql file using
drop table if exists dogs;
drop table if exists owners;
drop table if exists groomers;
create table dogs(
id serial primary key,
name varchar(255) not null,
breed varchar(255) not null,
owner integer,
groomer integer
);
create table owners(
id serial primary key,
name varchar(255) not null,
groomer integer,
dogs integer[]
);
create table groomers(
id serial primary key,
name varchar(255) not null,
rate integer not null,
owners integer[],
dogs integer[]
);
- In terminal, connect to your
DogGroomerdatabase - Once inside the psql database (you'll know you're in the right one if your terminal says
DogGroomer=#), copy and paste the seed data fromdogs.sql,groomers.sqlandowners.sqlinto your terminal. - Query for
*in each of the three tables to make sure the data was inputted correctly.
Activity
- In the
answers.sqlfile you will find a series of challenges. Below them, type the appropriate SQL command to access the data requested. - You must complete at least 8 of the provided challenges for a completion on this assignment.
Heads Up!
Some of the Data in the tables is in the form of an array! Check out the PostgreSQL Docs about arrays before you start!
Hungry For More?
- Use joins to solve the appropriate questions.
