Assignment 1
Assignment 1
Evaluation
Instructions:
1. Use any sql editor to attempt the below questions.
2. Write queries for each question wherever applicable.
3. Execute the queries in your console and get an output.
4. Copy the query from your console and take a screenshot of
output for each question, compile them for each question in a
word document.
5. Convert this word document into a PDF and submit it on the
Portal.
6. Strictly avoid plagiarism and or referring to the internet!
All the best !!!!
Section 1 - MCQs
Q1
You are given two tables, i.e., Employee personal details and Employee
Department details.
B. select * from
(select a.emp_id,
a.emp_name,
a.salary,
b.dept_id,
b.dept_name,
DENSE_RANK() over(partition by dept_id order by salary desc) as rank_1
from emp_details a , dept_details b
on a.emp_id = b.emp_id ) as c where rank_1= 4 ;
C. select * from
(select a.emp_id,
a.emp_name,
a.salary,
b.dept_id,
b.dept_name,
DENSE_RANK() over(partition by dept_id order by salary desc) as rank_1
from emp_details a inner join dept_details b
on a.emp_id = b.emp_id ) as c
where rank_1= 4
D. select * from
(select a.emp_id,
a.emp_name,
a.salary,
b.dept_id,
b.dept_name,
DENSE_RANK() over(partition by dept_id order by salary desc) as rank_1
from emp_details a left join dept_details b
on a.emp_name = b.emp_name ) as c
where rank_1= 4 ;
Q2
Given the tables below, write a SQL query that retrieves the personal data about alumni who
scored above 16 on their calculus class exam.
Sales_Team_Details:
Table1 :
Customer_orders_table
Cust_ID
Order_ID
Order_date
Order_Qty
A. select customer_id, min(a.order_date) as first_transaction_date, max(b.order_date) as
last_transaction_date
from customer_orders_table a, customer_orders_table b;
A. One table with unique values be related to a table that has multiple values for
each of the original values.
B. One table with not necessarily unique values be related to a table that has
multiple values for each of the original values.
C. One table with unique values be related to a table that has unique values same
as the original values.
D. None of the Above
Section 2
Data Files:
Owners.csv
Pets.csv
ProceduresDetails.csv
ProceduresHistory.csv
THE VET’S CLINIC
You are an Analyst working for a
Veterinarian Clinic. The Clinic’s owner wants
you to make some sense out of their data.
GROUP BY col1;