0% found this document useful (0 votes)
323 views

Zomato SQL Data Analysis

The document creates a zomato database and defines four tables within it: goldusers_signup to track user ids and their gold signup dates, users to track all user ids and signup dates, sales to track purchases with user ids, dates and product ids, and product to define the products with ids, names and prices. It populates the tables with sample data and performs select queries to retrieve data from all tables.

Uploaded by

Nick
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
323 views

Zomato SQL Data Analysis

The document creates a zomato database and defines four tables within it: goldusers_signup to track user ids and their gold signup dates, users to track all user ids and signup dates, sales to track purchases with user ids, dates and product ids, and product to define the products with ids, names and prices. It populates the tables with sample data and performs select queries to retrieve data from all tables.

Uploaded by

Nick
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create database zomato;

use zomato;

create table if not exists goldusers_signup


(
userid int,
gold_signup_date date
);
insert into goldusers_signup values(1,'2017-09-22'),(3,'2017-04-21');

create table if not exists users


(
userid int,
signup_date date
);
insert into users values(1,'2014-09-02'),(2,'2015-01-15'),(3,'2014-04-11');

create table if not exists sales


(
userid int,
created_date date,
product_id int
);
insert into sales values (1,'2017-04-19',2),
(3,'2019-12-18',1),
(2,'2020-07-20',3),
(1,'2019-10-23',2),
(1,'2018-03-19',3),
(3,'2016-12-20',2),
(1,'2016-11-09',1),
(1,'2016-05-20',3),
(2,'2017-09-24',1),
(1,'2017-03-11',2),
(1,'2016-03-11',1),
(3,'2016-11-10',1),
(3,'2017-12-07',2),
(3,'2016-12-15',2),
(2,'2017-11-08',2),
(2,'2018-09-10',3);

create table if not exists product


(
product_id int,
product_name varchar(20),
price int
);
insert into product values (1,'p1',980),
(2,'p2',870),
(3,'p3',330);

select * from goldusers_signup;


select * from product;
select * from sales;
select * from users;

You might also like