Abdelrahman107 / eT3-Database-Task

Database Task using SQL for eT3 internship.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eT3-Database-Task

In this task, it's required to Import the provided excel sheet into any relational database and answer certain questions using sql queries. This task is submitted to eT3 - Internship 2022

Installation

Install Any relational database, I used mysql workbench

https://dev.mysql.com/downloads/workbench/

Download the drinkMenu.csv dataset

https://drive.google.com/file/d/1osclWvpXTtIBV4t0fTBuPux74RkIkwmX/view

How to run MySQL workbench and import csv file

open MySQL workbench and press on localhost

type your root password

create a schema with any name

right click on tables of schema to import csv file

locate the path of the file and import it.

Questions and Answers

  1. Which drink has the highest calories from the dataset ?
SELECT Beverage,Calories as 'highest_calorie_drink'
FROM drink_menu.drink_menu_table
where Calories = (SELECT MAX(Calories) from drink_menu.drink_menu_table);

/* or */

SELECT Beverage,Calories as 'highest_calories_drink'
FROM drink_menu.drink_menu_table 
ORDER BY Calories DESC
LIMIT 1

  1. What is the average calorie amount for each drink category
SELECT Beverage_category , AVG(Calories)
FROM drink_menu.drink_menu_table
GROUP BY Beverage_category

  1. Which drinks have below average calorie amount ?
SELECT Beverage as "Drinks below average value (201.04)",Calories
FROM drink_menu.drink_menu_table
where Calories < (select avg(calories) from drink_menu.drink_menu_table)

About

Database Task using SQL for eT3 internship.