0% found this document useful (0 votes)
0 views17 pages

Day-3 Teradata

The document outlines a series of assignments focused on data analysis using Teradata, including creating tables for time series data and employee information. It specifies SQL queries for analyzing CPU utilization, temperature averages, employee demographics, and salary distributions across departments. Additionally, it includes tasks for extracting and manipulating job titles and roles within a company.

Uploaded by

Shreya Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views17 pages

Day-3 Teradata

The document outlines a series of assignments focused on data analysis using Teradata, including creating tables for time series data and employee information. It specifies SQL queries for analyzing CPU utilization, temperature averages, employee demographics, and salary distributions across departments. Additionally, it includes tasks for extracting and manipulating job titles and roles within a company.

Uploaded by

Shreya Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

DAY-3 Assignment

Teradata Assignments
Assignment 1
Time Series Data Analysis:
I. Create the below Tables as per the structure:

a. location_temp (event_time, temp_celcius, location_id)

create table location_temp(event_time


Date,temp_celcius number,location_id
integer);

b. utilization (event_time, server_id, cpu_utilization,


free_memory, session_cnt)

create table utilization (event_time Date, server_id


integer, cpu_utilization number, free_memory number,
session_cnt integer);

II. Perform the below analysis (Assuming the last digit of the
server_id isthe department_id):

a. Write a SQL query to compare the cpu_utilization with


in departmentfor every server_id used between '2019-03-
05' AND '2019-03-06'

Select server_id from utilization where server_id between( '2019-03-


05' AND '2019-03-06') group by server_id;

b. Rank the cpu_utilization of every server department wise.


Select RANK ( )
OVER ( partition by
cpu_utilizationOrder
by server_id)
From utilization;

III. Perform the below analysis:


a. Write a SQL query to find the daily average temperature

Select avg(temp_celcius) From location_temp Group by event_time;

b. Write a SQL query to calculate the average cpu_utilization of every


server

Select avg( cpu_utilization) from utilization Group by server id;

c. Write a SQL query to compare the avg temp of current day with avg
temp of previous day

Select avg(temp_celcius) From location_temp


Where event_time =sysdate or event_time=sysdate-1Group by
event_time;

d. Calculate the weighted moving average of the last days

Select event_time, avg(cpu_utilization) From utilization


Where event_time=sysdate or event_time = sysdate-1 orevent_time =
sysdate-2
Group by event_time;
DAY-3 Assignments
Assignment 2
I. Create the table and load the data using mock_staff.sql.
II. Perform the below analysis:

a. How many total employees in this company?

b. What about gender distribution?

c. How many employees in each department?


d. How many distinct departments?

III. Perform the below analysis:

a. What is the highest and lowest salary of employees?

b. What about salary distribution by gender group?

c. How much total salary company is spending each year?


d. Want to know distribution of min, max, average salary by
department?
DAY-3 Assignments
Assignment 2
I. Use the similar tables of Assignment 2.
II. Perform the below analysis:

a. Want to know distribution of min, max, average, variance, standard


deviation of salary by department.

b. Which department has the highest salary spread out?


III. Perform the below analysis:

a. Let’s see health department salary. We will make 3 buckets to see the
salary earning status for Health department.

salary >= 100000 THEN 'high earner'

salary >= 50000 AND salary < 100000 THEN 'middle earner'

salary < 50000 'low earner'


b. Let's find out about Outdoors department salary. We will make 3 buckets
to see the salary earning status for Outdoor Department.

salary >= 100000 THEN 'high earner'


salary >= 50000 AND salary < 100000 THEN 'middle earner'
salary < 50000 'low earner'
DAY-3 Assignments
Assignment 4
I. Use the table in Assignment 2 to perform the below analysis:

a. Distinct department

b. Concatenation of job_title and department

Created by – Dhriti Saluja


c. How many employees with Assistant roles?

d. What are those Assistant roles?

Created by – Dhriti Saluja


Created by – Dhriti Saluja
DAY-3 Assignments
Assignment 5
I. Use the table in Assignment 2 to perform the below analysis:
a. Find the substring of job_title from 3rd to 5th alphabet.

b. Extract job category from the assistant position which starts with
word Assistant.

Dhriti Saluja
c. As there are several duplicated ones, we want to know only unique
ones from the above question.

d. Replace word Assistant with Asst

Dhriti Saluja
e. Display job title with Assistant with Level 3 and 4

f. Display job title with Assistant, started with roman numeral I,


followed by 1 character it can be II, IV, etc. as long as it starts with
character I.

Dhriti Saluja
g. Job title starts with either E, P or S character, followed by any
characters

Dhriti Saluja
Dhriti Saluja

You might also like