D A T A B A S E C R E A T I O N :
P G A D M I N
Spring 2023
// Kozub
Applying this schema and creating a new
database in pgAdmin is straightforward and
can be quickly done either manually or by
using SQL commands. In this instance, the
following SQL command (right) was used to
create the schema and tables.
This SQL code is a direct translation to the
diagram shown previously. The CREATE
function in SQL allows the user to create
the specified tables with the specified
columns and data types.
This is important because the data type
determines how the data is encoded and
stored, so selecting the appropriate data
type is crucial for maintaining data
integrity.
CREATE TABLE public.allrecipes_combined (
unique_id character varying(255),
recipe_name character varying(255),
recipe_url character varying(2048),
recipe_description text,
recipe_ingredients text,
recipe_calories integer,
recipe_fat character varying(255),
recipe_carbs character varying(255),
recipe_protein character varying(255),
scrape_date date,
category character varying(255)
);
CREATE TABLE public.allrecipes_ingredients (
unique_id character varying(10),
ingredient character varying(100)
);
CREATE TABLE public.heb_combined (
item_id character varying(255),
item_name character varying(255),
item_url character varying(2048),
item_price character varying(255),
scrape_date date,
category character varying(255)
);
CREATE TABLE public.mcdonalds_cleaned (
mcd_id character varying(255),
mcd_category character varying(255),
mcd_cat_url character varying(2048),
mcd_name character varying(255),
mcd_url character varying(2048),
mcd_desc text,
mcd_ingredients text,
scrape_date date
);
CREATE TABLE public.mcdonalds_ingredients (
mcd_id character varying(10),
ingredient character varying(100)
);
CREATE TABLE public.whataburger_cleaned (
wb_id character varying(255),
wb_name character varying(255),
wb_ingredients text,
wb_price_cal character varying(255),
wb_calories integer,
scrape_date date
);
CREATE TABLE public.whataburger_ingredients (
wb_id character varying(10),
ingredient character varying(100)
);
9